Part Number Hot Search : 
N25F80 IZ800 V600ME V600ME M2TXX 1N1202A STK40 FMG23S
Product Description
Full Text Search
 

To Download ADE-702-037 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  to our customers, old company name in catalogs and other documents on april 1 st , 2010, nec electronics corporation merged with renesas technology corporation, and renesas electronics corporation took over all the business of both companies. therefore, although the old company name remains in this document, it is a valid renesas electronics document. we appreciate your understanding. renesas electronics website: http://www.renesas.com april 1 st , 2010 renesas electronics corporation issued by: renesas electronics corporation ( http://www.renesas.com ) send any inquiries to http://www.renesas.com/inquiry .
notice 1. all information included in this document is current as of the date this document is issued. such information, however, is subject to change without any prior notice. before purchasing or using any renesas electronics products listed herein, please confirm the latest product information with a renesas electronics sales office. also, please pay regular and careful attention to additional and different information to be disclosed by renesas electronics such as that disclosed through our website. 2. renesas electronics does not assume any liability for infringement of patents, copyrights, or other intellectual property ri ghts of third parties by or arising from the use of renesas electronics products or technical information described in this document . no license, express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property right s of renesas electronics or others. 3. you should not alter, modify, copy, or otherwise misappropriate any renesas electronics product, whether in whole or in part . 4. descriptions of circuits, software and other related information in this document are provided only to illustrate the operat ion of semiconductor products and application examples. you are fully responsible for the incorporation of these circuits, software, and information in the design of your equipment. renesas electronics assumes no responsibility for any losses incurred by you or third parties arising from the use of these circuits, software, or information. 5. when exporting the products or technology described in this document, you should comply with the applicable export control laws and regulations and follow the procedures required by such laws and regulations. you should not use renesas electronics products or the technology described in this document for any purpose relating to military applications or use by the military, including but not limited to the development of weapons of mass destruction. renesas electronics products and technology may not be used for or incorporated into any products or systems whose manufacture, use, or sale is prohibited under any applicable domestic or foreign laws or regulations. 6. renesas electronics has used reasonable care in preparing the information included in this document, but renesas electronics does not warrant that such information is error free. renesas electronics assumes no liability whatsoever for any damages incurred by you resulting from errors in or omissions from the information included herein. 7. renesas electronics products are classified according to the following three quality grades: ?standard?, ?high quality?, an d ?specific?. the recommended applications for each renesas electronics product depends on the product?s quality grade, as indicated below. you must check the quality grade of each renesas electronics product before using it in a particular application. you may not use any renesas electronics product for any application categorized as ?specific? without the prior written consent of renesas electronics. further, you may not use any renesas electronics product for any application for which it is not intended without the prior written consent of renesas electronics. renesas electronics shall not be in any way liable for any damages or losses incurred by you or third parties arising from the use of any renesas electronics product for a n application categorized as ?specific? or for which the product is not intended where you have failed to obtain the prior writte n consent of renesas electronics. the quality grade of each renesas electronics product is ?standard? unless otherwise expressly specified in a renesas electronics data sheets or data books, etc. ?standard?: computers; office equipment; communications equipment; test and measurement equipment; audio and visual equipment; home electronic appliances; machine tools; personal electronic equipment; and industrial robots. ?high quality?: transportation equipment (automobiles, trains, ships, etc.); traffic control systems; anti-disaster systems; an ti- crime systems; safety equipment; and medical equipment not specifically designed for life support. ?specific?: aircraft; aerospace equipment; submersible repeaters; nuclear reactor control systems; medical equipment or systems for life support (e.g. artificial life support devices or systems), surgical implantations, or healthcare intervention (e.g. excision, etc.), and any other applications or purposes that pose a direct threat to human life. 8. you should use the renesas electronics products described in this document within the range specified by renesas electronics , especially with respect to the maximum rating, operating supply voltage range, movement power voltage range, heat radiation characteristics, installation and other product characteristics. renesas electronics shall have no liability for malfunctions o r damages arising out of the use of renesas electronics products beyond such specified ranges. 9. although renesas electronics endeavors to improve the quality and reliability of its products, semiconductor products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. fur ther, renesas electronics products are not subject to radiation resistance design. please be sure to implement safety measures to guard them against the possibility of physical injury, and injury or damage caused by fire in the event of the failure of a renesas electronics product, such as safety design for hardware and software including but not limited to redundancy, fire control and malfunction prevention, appropriate treatment for aging degradation or any other appropriate measures. because the evaluation of microcomputer software alone is very difficult, please evaluate the safety of the final products or system manufactured by you. 10. please contact a renesas electronics sales office for details as to environmental matters such as the environmental compatibility of each renesas electronics product. please use renesas electronics products in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances, including without limitation, the eu rohs directive. renesas electronics assumes no liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations. 11. this document may not be reproduced or duplicated, in any form, in whole or in part, without prior written consent of renes as electronics. 12. please contact a renesas electronics sales office if you have any questions regarding the information contained in this document or renesas electronics products, or if you have any other inquiries. (note 1) ?renesas electronics? as used in this document means renesas electronics corporation and also includes its majority- owned subsidiaries. (note 2) ?renesas electronics product(s)? means any product developed or manufactured by or for renesas electronics.
h8s/2319 group hardware manual 16 users manual rev.7.00 2007.02 renesas 16-bit single-chip microcomputer h8s family/h8s/2300 series
rev.7.00 feb. 14, 2007 page ii of xxxii rej09b0089-0700 1. this document is provided for reference purposes only so that renesas customers may select the appropriate renesas products for their use. renesas neither makes warranties or representations with respect to the accuracy or completeness of the information contained in this document nor grants any license to any intellectual property rights or any other rights of renesas or any third party with respect to the information in this document. 2. renesas shall have no liability for damages or infringement of any intellectual property or other rights arising out of the use of any information in this document, including, but not limited to, product data, diagrams, charts, programs, algorithms, and application circuit examples. 3. you should not use the products or the technology described in this document for the purpose of military applications such as the development of weapons of mass destruction or for the purpose of any other military use. when exporting the products or technology described herein, you should follow the applicable export control laws and regulations, and procedures required by such laws and regulations. 4. all information included in this document such as product data, diagrams, charts, programs, algorithms, and application circuit examples, is current as of the date this document is issued. such information, however, is subject to change without any prior notice. before purchasing or using any renesas products listed in this document, please confirm the latest product information with a renesas sales office. also, please pay regular and careful attention to additional and different information to be disclosed by renesas such as that disclosed through our website. (http://www.renesas.com ) 5. renesas has used reasonable care in compiling the information included in this document, but renesas assumes no liability whatsoever for any damages incurred as a result of errors or omissions in the information included in this document. 6. when using or otherwise relying on the information in this document, you should evaluate the information in light of the total system before deciding about the applicability of such information to the intended application. renesas makes no representations, warranties or guaranties regarding the suitability of its products for any particular application and specifically disclaims any liability arising out of the application and use of the information in this document or renesas products. 7. with the exception of products specified by renesas as suitable for automobile applications, renesas products are not designed, manufactured or tested for applications or otherwise in systems the failure or malfunction of which may cause a direct threat to human life or create a risk of human injury or which require especially high quality and reliability such as safety systems, or equipment or systems for transportation and traffic, healthcare, combustion control, aerospace and aeronautics, nuclear power, or undersea communication transmission. if you are considering the use of our products for such purposes, please contact a renesas sales office beforehand. renesas shall have no liability for damages arising out of the uses set forth above. 8. notwithstanding the preceding paragraph, you should not use renesas products for the purposes listed below: (1) artificial life support devices or systems (2) surgical implantations (3) healthcare intervention (e.g., excision, administration of medication, etc.) (4) any other purposes that pose a direct threat to human life renesas shall have no liability for damages arising out of the uses set forth in the above and purchasers who elect to use renesas products in any of the foregoing applications shall indemnify and hold harmless renesas technology corp., its affiliated companies and their officers, directors, and employees against any and all damages arising out of such applications. 9. you should use the products described herein within the range specified by renesas, especially with respect to the maximum rating, operating supply voltage range, movement power voltage range, heat radiation characteristics, installation and other product characteristics. renesas shall have no liability for malfunctions or damages arising out of the use of renesas products beyond such specified ranges. 10. although renesas endeavors to improve the quality and reliability of its products, ic products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. please be sure to implement safety measures to guard against the possibility of physical injury, and injury or damage caused by fire in the event of the failure of a renesas product, such as safety design for hardware and software including but not limited to redundancy, fire control and malfunction prevention, appropriate treatment for aging degradation or any other applicable measures. among others, since the evaluation of microcomputer software alone is very difficult, please evaluate the safety of the final products or system manufactured by you. 11. in case renesas products listed in this document are detached from the products to which the renesas products are attached or affixed, the risk of accident such as swallowing by infants and small children is very high. you should implement safety measures so that renesas products may not be easily detached from your products. renesas shall have no liability for damages arising out of such detachment. 12. this document may not be reproduced or duplicated, in any form, in whole or in part, without prior written approval from renesas. 13. please contact a renesas sales office if you have any questions regarding the information contained in this document, renesas semiconductor products, or if you have any other inquiries. notes regarding these materials
rev.7.00 feb. 14, 2007 page iii of xxxii rej09b0089-0700 general precautions in the handling of mpu/mcu products the following usage notes are applicable to all mpu/mcu products from renesas. for detailed usage notes on the products covered by this manual, refer to the relevant sections of the manual. if the descriptions under general precautions in the handling of mpu/mcu products and in the body of the manual differ from each other, the description in the body of the manual takes precedence. 1. handling of unused pins handle unused pins in accord with the directions given under handling of unused pins in the manual. ? the input pins of cmos products are generally in the high-impedance state. in operation with an unused pin in the open-circuit state, extra electromagnetic noise is induced in the vicinity of lsi, an associated shoot-through current flows internally, and malfunctions may occur due to the false recognition of the pin state as an input signal. unused pins should be handled as described under handling of unused pins in the manual. 2. processing at power-on the state of the product is undefined at the moment when power is supplied. ? the states of internal circuits in the lsi are indeterminate and the states of register settings and pins are undefined at the moment when power is supplied. in a finished product where the reset signal is applied to the external reset pin, the states of pins are not guaranteed from the moment when power is supplied until the reset process is completed. in a similar way, the states of pins in a product that is reset by an on-chip power-on reset function are not guaranteed from the moment when power is supplied until the power reaches the level at which resetting has been specified. 3. prohibition of access to reserved addresses access to reserved addresses is prohibited. ? the reserved addresses are provided for the possible future expansion of functions. do not access these addresses; the correct operation of lsi is not guaranteed if they are accessed. 4. clock signals after applying a reset, only release the reset line after the operating clock signal has become stable. when switching the clock signal during program execution, wait until the target clock signal has stabilized. ? when the clock signal is generated with an external resonator (or from an external oscillator) during a reset, ensure that the reset line is only released after full stabilization of the clock signal. moreover, when switching to a clock signal produced with an external resonator (or by an external oscillator) while program execution is in progress, wait until the target clock signal is stable. 5. differences between products before changing from one product to another, i.e. to one with a different type number, confirm that the change will not lead to problems. ? the characteristics of mpu/mcu in the same group but having different type numbers may differ because of the differences in internal memory capacity and layout pattern. when changing to products of different type numbers, implement a system-evaluation test for each of the products.
rev.7.00 feb. 14, 2007 page iv of xxxii rej09b0089-0700
rev.7.00 feb. 14, 2007 page v of xxxii rej09b0089-0700 preface this lsi is a single-chip microcomputer made up of the h8s/2000 cpu with an internal 32-bit architecture as its core, and the peripheral functions required to configure a system. this lsi is equipped with rom, ram, a bus controller, data transfer controller (dtc), a 16-bit timer pulse unit (tpu), a watchdog timer (wdt), a serial communication interface (sci), a d/a converter, an a/d converter, and i/o ports as on-chip supporting modules. this lsi is suitable for use as an embedded processor for high-level control systems. its on-chip rom are flash memory (f-ztat?*) and mask rom that provides flexibility as it can be reprogrammed in no time to cope with all situations from the early stages of mass production to full-scale mass production. this is particularly applicable to application devices with specifications that will most probably change. note: * f-ztat is a trademark of renesas technology corp. target users: this manual was written for users who will be using the h8s/2319 group in the design of application systems. members of this audience are expected to understand the fundamentals of electrical circuits , logical circuits, and microcomputers. objective: this manual was written to explain the hardware functions and electrical characteristics of the h8s/2319 group to the above audience. refer to the h8s/2600 series, h8s/2000 series software manual for a detailed description of the instruction set. notes on reading this manual: ? in order to understand the overall functions of the chip read the manual according to the contents. this manual can be roughly categorized into parts on the cpu, system control functions, periph eral functions and electrical characteristics. ? in order to understand the details of the cpu's functions read the h8s/2600 series, h8s/2000 series software manual.
rev.7.00 feb. 14, 2007 page vi of xxxii rej09b0089-0700 ? in order to understand the details of a register when its name is known the addresses, bits, and initial values of the registers are summarized in appendix b, internal i/o registers. examples: register name: the following notation is used for cases when the same or a similar function, e.g. 16-bit timer pulse unit or serial communication, is implemented on more than one channel: xxx_n (xxx is the register name and n is the channel number) bit order: the msb is on the left and the lsb is on the right. number notation: binary is b'xxxx, hexadecimal is h'xxxx, decimal is xxxx signal notation: an overbar is added to a low-active signal: xxxx related manuals: the latest versions of all related manuals are available from our web site. please ensure you have the latest versions of all documents you require. (http://www.renesas.com/) h8s/2319 group manuals: document title document no. h8s/2319 group hardware manual this manual h8s/2600 series, h8s/2000 series software manual rej09b0139 user?s manuals for development tools: document title document no. h8s, h8/300 series c/c++ compiler, assembler, optimized linkage editor user's manual rej10b0058 h8s, h8/300 series simulator/debugger (for windows) user's manual ADE-702-037 high-performance embedded workshop (for windows 95/98 and windows nt 4.0) user's manual ade-702-201 application notes: document title document no. h8s series technical q&a application note rej05b0397
rev.7.00 feb. 14, 2007 page vii of xxxii rej09b0089-0700 main revisions for this edition item page revision (see manual for details) 1.3.1 pin arrangement figure 1.6 hd64f2319clp, hd6432317slp, hd6432316slp pin arrangement (tlp- 113v: top view) 13 figure 1.6 amended (before) tlp-113v (top view) (after) (top view) 2.6.3 table of instructions classified by function table 2.3 instructions classified by function 45 table 2.3 amended movfpe, movtpe (before) cannot be used in the h8s/2357 series. (after) cannot be used in the h8s/2319 group. 6.3.5 chip select signals 156 description amended ... the data direction register (ddr) ,cs167 enable(cs167e), cs25 enable, css17, css36, pf1cs5s, pf0cs4s for the port corresponding to the particular csn pin. ... the corresponding control registers bits should be set when outputting signals cs1 to cs7 . ... the corresponding control registers bits should be set when outputting signals cs0 to cs7 . ... 8.2.2 register configuration 223, 224 port 1 data direction register (p1ddr) port 1 data register (p1dr) port 1 register (port1) description amended (before) ... retains its prior state after in software standby mode. (after) ... retains its prior state in software standby mode. 8.3.2 register configuration 236, 237 port 2 data direction register (p2ddr) port 2 data register (p2dr) port 2 register (port2) description amended (before) ... retains its prior state after in software standby mode. (after) ... retains its prior state in software standby mode.
rev.7.00 feb. 14, 2007 page viii of xxxii rej09b0089-0700 item page revision (see manual for details) 8.4.2 register configuration 247, 248 port 3 data direction register (p3ddr) port 3 data register (p3dr) port 3 register (port3) port 3 open drain control register (p3odr) description amended (before) ... retains its prior state after in software standby mode. (after) ... retains its prior state in software standby mode. 8.6.2 register configuration 254 to 256 port a data direction register (paddr) port a data register (padr) port a register (porta) port a open drain control register (paodr) description amended (before) ... retains its prior state after in software standby mode. (after) ... retains its prior state in software standby mode. 8.11.2 register configuration 284, 285 port f data direction register (pfddr) port f data register (pfdr) port f register (portf) description amended (before) ... retains its prior state after in software standby mode. (after) ... retains its prior state in software standby mode. 8.12.2 register configuration 294, 295 port g data direction register (pgddr) port g data register (pgdr) port g register (portg) description amended (before) ... retains its prior state after in software standby mode. (after) ... retains its prior state in software standby mode.
rev.7.00 feb. 14, 2007 page ix of xxxii rej09b0089-0700 item page revision (see manual for details) 12.2.8 bit rate register (brr) table 12.3 brr settings for various bit rates (asynchronous mode) 452 table 12.3 amended = 25 mhz bit rate (bits/s) n n error (% ) 110 3 110 ?0.02 150 3 80 0.47 ?0.15 300 2 162 600 2 80 0.47 1200 1 162 ?0.15 2400 1 80 0.47 4800 0 162 ?0.15 9600 0 80 0.47 19200 0 40 ?0.76 31250 0 24 0.00 38400 0 19 1.73 14.4.3 input sampling and a/d conversion time figure 14.5 a/d conversion timing 545 figure 14.5 amended (1) (2) t d t spl t conv input sampling timing a df address bus write signal 17.4.1 features 571 description amended ? reprogramming capability the flash memory can be reprogrammed a minimum of 100 times.
rev.7.00 feb. 14, 2007 page x of xxxii rej09b0089-0700 item page revision (see manual for details) 17.8.3 error protection 604 description amended (before) ? when a bus master other than the cpu (the dmac or dtc) has control ... (after) ? when a bus master other than the cpu (the dtc) has control ... 17.11.2 socket adapters and memory map 609 description added in programmer mode, ... figure 17.21. this enables the chip to fit a 40-pin socket. figure 17.20 shows ... 17.13.1 features 629 description amended ? reprogramming capability the flash memory can be reprogrammed a minimum of 100 times. 17.17.3 error protection 664 description amended (before) ? when a bus master other than the cpu (the dmac or dtc) has control ... (after) ? when a bus master other than the cpu (the dtc) has control ... 17.20.2 socket adapters and memory map 670 description added in programmer mode, ... figure 17.51. this enables the chip to fit a 40-pin socket. figure 17.50 shows ... 17.22.1 features 686 description amended ? protection modes there are three protection modes: software protection by the register setting, hardware protection by reset/hardware standby, and error protection. the protection ... 17.22.4 mode comparison table 17.46 comparison of programming modes 690 table 17.46 amended boot mode user program mode user boot mode prom mode programming/ erasing environment on-board programming on-board programming on-board programming on-board programmi ng programming/ erasing enable mat user mat user boot mat user mat user mat user mat user boot ma t program/erase control command method programming/ erasing interface programming/ erasing interface command method all erasure (automatic) (automatic) 17.23.2 programming/erasing interface parameter 704 description amended ... the cpu except for er0 and er1 are stored. the return value of ... the registers except for er0 and er1, the stack area must be ...
rev.7.00 feb. 14, 2007 page xi of xxxii rej09b0089-0700 item page revision (see manual for details) 17.24.2 user program mode 729 programming procedure in user program mode: description amended (g) initialization ? the general registers other than er0 and er1 are saved in the initialization program. 730 (l) programming ? the general registers other than er0 and er1 are saved in the programming program. 17.25 protection 738 description amended there are three kinds of flash memory program/erase protection: hardware, software protection, and error protection. status description amended (2) inquiry/selection state ... required for erasure to the on-chip ram and erases ... 17.29.1 serial communication interface specification for boot mode 754 (3) programming/erasing state ... the programming/erasing programs to the on-chip ram by commands ... 759 inquiry and selection states description amended (2) device selection ? size (1 byte): amount of device-code data this is fixed to 4 760 (3) clock mode inquiry (before) response h'31 siz a number of modes e mode su m (after) response h'31 size mode su m ? size (1 byte): amount of data that represents the modes ? mode (1 byte): values of the supported ...
rev.7.00 feb. 14, 2007 page xii of xxxii rej09b0089-0700 item page revision (see manual for details) 17.29.1 serial communication interface specification for boot mode 773 programming/erasing state (4) 128-byte programming description amended ? error: (1 byte) error code h'11: checksum error h'2a: address error 17.29.3 procedure program and storable area for programming data table 17.73 (3) usable area for programming in user boot mode 791 table 17.73 (3) amended storable/executable area selected ma t item on-chip ram user boot mat external space (expanded mode) user mat user boot mat embedded program storage area switching mats by fmats 19.1 overview table 19.1 operating modes 802 table 19.1 amended operating mode transition condition clearing condition oscillator high speed mode control register control register functions medium- speed mode control register control register functions sleep mode instruction interrupt functions module stop mode control register control register functions software standby mode instruction external interrupt halted hardware standby mode pin pin halted 20.2.5 d/a conversion characteristics table 20.18 d/a conversion characteristics 848 " ? preliminary ? " deleted from table 20.18
rev.7.00 feb. 14, 2007 page xiii of xxxii rej09b0089-0700 item page revision (see manual for details) 20.2.6 flash memory characteristics table 20.19 flash memory characteristics 848 " ? preliminary ? " deleted from table 20.19 20.1 electrical characteristics of mask rom version (h8s/2319, h8s/2318, h8s/2317s, h8s/2316s, h8s/2315, h8s/2314) and romless version (h8s/2312s) 817 section 20.1 title amended 20.2.6 flash memory characteristics table 20.19 flash memory characteristics 849 table 20.19 amended item symbol min typ max unit test conditions programming time * 1 * 2 * 4 t p ? 10 200 ms/ 128 bytes erase time * 1 * 3 * 6 t e ? 50 1000 ms/block reprogramming count n wec 100 * 7 10000 * 8 ? times data retention time * 9 t drp 10 ? ? years programming wait time after swe bit setting * 1 x 1 ? ? s 850 notes 7 to 9 added notes: 7. minimum number of times for which all characteristics are guaranteed after rewriting ( guarantee range is 1 to minimum value). 8. reference value for 25c (as a guideline, rewriting should normally function up to this value). 9. data retention characteristic when rewriting is performed within the specification range, including the minimum value. 20.3.2 dc characteristics table 20.21 dc characteristics 853 table 20.21 amended vcc start voltage * 5 vcc start ? ? 0.4 v vcc rising edge * 5 svcc ? ? 10 ms/v item symbol min typ maxu nit test conditions note 5 added note: 5. applies on condition that the res pin is low level at power on.
rev.7.00 feb. 14, 2007 page xiv of xxxii rej09b0089-0700 item page revision (see manual for details) 20.3.6 flash memory characteristics table 20.29 flash memory characteristics 860 table 20.29 amended item symbol min typ max unit test conditions number of overwrites nwec 100 * 3 10000 * 5 ? times data retention time * 4 t drp 10 ? ? years note 5 added note: 5. reference value for 25c (as a guideline, rewriting should normally function up to this value). appendix e products lineup table e.1 h8s/2319 group products lineup 1103 table e.1 amended hd64f2319e * 1 h8s/2317(s) * 2 1104 notes amended notes: 1. the on-chip debug function can be used with the e10a emulator (e10a compatible version). 2. h8s/2317s in mask rom version. f. package dimensions figure f.4 tlp-113v package dimensions figure f.4 replaced all trademarks and registered trademarks are the property of their respective owners.
rev.7.00 feb. 14, 2007 page xv of xxxii rej09b0089-0700 contents section 1 overview............................................................................................1 1.1 overview....................................................................................................................... .... 1 1.2 block diagram .................................................................................................................. 8 1.3 pin description................................................................................................................ .. 9 1.3.1 pin arrangement .................................................................................................. 9 1.3.2 pin functions in each operating mode ............................................................... 14 1.3.3 pin functions ....................................................................................................... 18 section 2 cpu....................................................................................................27 2.1 overview....................................................................................................................... .... 27 2.1.1 features................................................................................................................ 27 2.1.2 differences between h8s/2600 cpu and h8s/2000 cpu .................................. 28 2.1.3 differences from h8/300 cpu ............................................................................ 29 2.1.4 differences from h8/300h cpu.......................................................................... 29 2.2 cpu operating modes ...................................................................................................... 30 2.3 address space .................................................................................................................. .33 2.4 register configuration...................................................................................................... 34 2.4.1 overview.............................................................................................................. 34 2.4.2 general registers ................................................................................................. 35 2.4.3 control registers ................................................................................................. 36 2.4.4 initial register values.......................................................................................... 38 2.5 data formats ................................................................................................................... .. 38 2.5.1 general register data formats ............................................................................ 39 2.5.2 memory data formats ......................................................................................... 41 2.6 instruction set ................................................................................................................ ... 42 2.6.1 overview.............................................................................................................. 42 2.6.2 instructions and a ddressing modes ..................................................................... 43 2.6.3 table of instructions classified by function ...................................................... 44 2.6.4 basic instruction formats .................................................................................... 54 2.7 addressing modes and effective address calculation ..................................................... 55 2.7.1 addressing mode ................................................................................................. 55 2.7.2 effective address calculation ............................................................................. 58 2.8 processing states.............................................................................................................. .62 2.8.1 overview.............................................................................................................. 62 2.8.2 reset state............................................................................................................ 63 2.8.3 exception-handling state .................................................................................... 64 2.8.4 program execution state...................................................................................... 66
rev.7.00 feb. 14, 2007 page xvi of xxxii rej09b0089-0700 2.8.5 bus-released state............................................................................................... 66 2.8.6 power-down state ............................................................................................... 66 2.9 basic timing................................................................................................................... .. 67 2.9.1 overview.............................................................................................................. 67 2.9.2 on-chip memory (rom, ram) ......................................................................... 67 2.9.3 on-chip supporting modu le access timing....................................................... 69 2.9.4 external address space access timing .............................................................. 70 2.10 usage note..................................................................................................................... ... 70 2.10.1 tas instruction.................................................................................................... 70 section 3 mcu operating modes .....................................................................71 3.1 overview....................................................................................................................... .... 71 3.1.1 operating mode selection (h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8 s/2314 f-zt at)....................................................................... 71 3.1.2 operating mode selection (mask rom, romless, h8s/2319 f-ztat, and h8s/2319c f-ztat)........................................................................................... 72 3.1.3 register configuration......................................................................................... 74 3.2 register descriptions ........................................................................................................ 74 3.2.1 mode control register (mdcr) ......................................................................... 74 3.2.2 system control register (syscr) ...................................................................... 75 3.2.3 system control register 2 (syscr2) (f-ztat versions only)........................ 76 3.3 operating mode descriptions ........................................................................................... 77 3.3.1 mode 1 (h8s/2319c f-ztat only) ................................................................... 77 3.3.2 mode 2 (h8s/2319 f-ztat an d h8s/2319c f-ztat only)............................. 77 3.3.3 mode 3 (h8s/2319 f-ztat an d h8s/2319c f-ztat only)............................. 78 3.3.4 mode 4 (expanded mode with on-chip rom disabled) ................................... 78 3.3.5 mode 5 (expanded mode with on-chip rom disabled) ................................... 78 3.3.6 mode 6 (expanded mode with on-chip rom enabled) .................................... 79 3.3.7 mode 7 (single-chip mode) ................................................................................ 79 3.3.8 modes 8 an d 9...................................................................................................... 79 3.3.9 mode 10 (h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat only) .................................................................................... 79 3.3.10 mode 11 (h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat only) .................................................................................... 79 3.3.11 modes 12 and 13.................................................................................................. 80 3.3.12 mode 14 (h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat only) .................................................................................... 80 3.3.13 mode 15 (h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat only) .................................................................................... 80 3.4 pin functions in each operating mode ............................................................................ 80
rev.7.00 feb. 14, 2007 page xvii of xxxii rej09b0089-0700 3.5 memory map in each operating mode ............................................................................ 81 section 4 exception handling ...........................................................................99 4.1 overview....................................................................................................................... .... 99 4.1.1 exception handling types and priority............................................................... 99 4.1.2 exception handling operation............................................................................. 100 4.1.3 exception vector table ....................................................................................... 100 4.2 reset.......................................................................................................................... ........ 102 4.2.1 overview.............................................................................................................. 102 4.2.2 reset sequence .................................................................................................... 102 4.2.3 interrupts after reset............................................................................................ 103 4.2.4 state of on-chip supporting modules after reset release ................................. 103 4.3 traces......................................................................................................................... ....... 104 4.4 interrupts ..................................................................................................................... ...... 105 4.5 trap instruction............................................................................................................... .. 106 4.6 stack status after exception handling.............................................................................. 106 4.7 notes on use of the stack ................................................................................................. 107 section 5 interrupt controller ............................................................................109 5.1 overview....................................................................................................................... .... 109 5.1.1 features................................................................................................................ 109 5.1.2 block diagram..................................................................................................... 110 5.1.3 pin configuration................................................................................................. 111 5.1.4 register configuration......................................................................................... 111 5.2 register descriptions ........................................................................................................ 11 2 5.2.1 system control register (syscr) ...................................................................... 112 5.2.2 interrupt priority registers a to k (ipra to iprk) ............................................ 113 5.2.3 irq enable register (ier) .................................................................................. 114 5.2.4 irq sense control registers h and l (iscrh, iscrl)..................................... 115 5.2.5 irq status register (isr).................................................................................... 116 5.3 interrupt sources .............................................................................................................. . 117 5.3.1 external interrupts ............................................................................................... 117 5.3.2 internal interrupts................................................................................................. 118 5.3.3 interrupt exception vector table ........................................................................ 118 5.4 interrupt operation............................................................................................................ 124 5.4.1 interrupt control modes and interrupt operation ................................................ 124 5.4.2 interrupt control mode 0 ..................................................................................... 127 5.4.3 interrupt control mode 2 ..................................................................................... 129 5.4.4 interrupt exception handling sequence .............................................................. 131 5.4.5 interrupt res ponse times .................................................................................... 133
rev.7.00 feb. 14, 2007 page xviii of xxxii rej09b0089-0700 5.5 usage notes .................................................................................................................... .. 134 5.5.1 contention between interrupt generation and disabling..................................... 134 5.5.2 instructions that disable interrupts ...................................................................... 135 5.5.3 times when interrupts are disabled .................................................................... 135 5.5.4 interrupts during execution of eepmov instruction.......................................... 135 5.6 dtc activation by interrupt............................................................................................. 136 5.6.1 overview.............................................................................................................. 136 5.6.2 block diagram..................................................................................................... 136 5.6.3 operation ............................................................................................................. 137 section 6 bus controller....................................................................................139 6.1 overview....................................................................................................................... .... 139 6.1.1 features................................................................................................................ 139 6.1.2 block diagram..................................................................................................... 140 6.1.3 pin configuration................................................................................................. 141 6.1.4 register configuration......................................................................................... 142 6.2 register descriptions ........................................................................................................ 14 3 6.2.1 bus width control re gister (a bwcr) ............................................................... 143 6.2.2 access state control register (astcr) ............................................................. 144 6.2.3 wait control registers h and l (wcrh, wcrl).............................................. 145 6.2.4 bus control register h (bcrh) ......................................................................... 148 6.2.5 bus control regist er l ( bcrl) .......................................................................... 150 6.3 overview of bus control .................................................................................................. 152 6.3.1 area partitioning.................................................................................................. 152 6.3.2 bus specifications................................................................................................ 153 6.3.3 memory interfaces ............................................................................................... 154 6.3.4 advanced mode ................................................................................................... 155 6.3.5 chip select signals .............................................................................................. 156 6.4 basic bus interface ........................................................................................................... 1 57 6.4.1 overview.............................................................................................................. 157 6.4.2 data size and data alignment............................................................................. 157 6.4.3 valid strobes........................................................................................................ 159 6.4.4 basic timing........................................................................................................ 160 6.4.5 wait control ........................................................................................................ 168 6.5 burst rom interface......................................................................................................... 170 6.5.1 overview.............................................................................................................. 170 6.5.2 basic timing........................................................................................................ 170 6.5.3 wait control ........................................................................................................ 172 6.6 idle cycle ..................................................................................................................... ..... 173 6.6.1 operation ............................................................................................................. 173
rev.7.00 feb. 14, 2007 page xix of xxxii rej09b0089-0700 6.6.2 pin states in idle cycle ........................................................................................ 176 6.7 bus release.................................................................................................................... ... 177 6.7.1 overview.............................................................................................................. 177 6.7.2 operation ............................................................................................................. 177 6.7.3 pin states in external bus released state............................................................ 178 6.7.4 transition timing ................................................................................................ 179 6.7.5 usage note........................................................................................................... 180 6.8 bus arbitration................................................................................................................ .. 180 6.8.1 overview.............................................................................................................. 180 6.8.2 operation ............................................................................................................. 180 6.8.3 bus transfer timing ............................................................................................ 181 6.8.4 external bus release usage note........................................................................ 181 6.9 resets and the bus controller ........................................................................................... 181 section 7 data transfer controller ....................................................................183 7.1 overview....................................................................................................................... .... 183 7.1.1 features................................................................................................................ 183 7.1.2 block diagram..................................................................................................... 184 7.1.3 register configuration......................................................................................... 185 7.2 register descriptions ........................................................................................................ 18 6 7.2.1 dtc mode register a (mra) ............................................................................ 186 7.2.2 dtc mode register b (mrb)............................................................................. 187 7.2.3 dtc source address register (sar).................................................................. 189 7.2.4 dtc destination address register (dar).......................................................... 189 7.2.5 dtc transfer count register a (cra) .............................................................. 189 7.2.6 dtc transfer count register b (crb)............................................................... 190 7.2.7 dtc enable registers (dtcer) ......................................................................... 190 7.2.8 dtc vector register (dtvecr)........................................................................ 191 7.2.9 module stop control register (mstpcr) .......................................................... 192 7.3 operation...................................................................................................................... ..... 193 7.3.1 overview.............................................................................................................. 193 7.3.2 activation sources ............................................................................................... 197 7.3.3 dtc vector table................................................................................................ 198 7.3.4 location of register information in address space ............................................ 201 7.3.5 normal mode ....................................................................................................... 202 7.3.6 repeat mode ........................................................................................................ 203 7.3.7 block transfer mode ........................................................................................... 204 7.3.8 chain transfer ..................................................................................................... 206 7.3.9 operation timing................................................................................................. 207 7.3.10 number of dtc execution states ....................................................................... 208
rev.7.00 feb. 14, 2007 page xx of xxxii rej09b0089-0700 7.3.11 procedures for using dtc................................................................................... 210 7.3.12 examples of use of the dtc ............................................................................... 211 7.4 interrupts ..................................................................................................................... ...... 215 7.5 usage notes .................................................................................................................... .. 215 section 8 i/o ports.............................................................................................217 8.1 overview....................................................................................................................... .... 217 8.2 port 1......................................................................................................................... ........ 222 8.2.1 overview.............................................................................................................. 222 8.2.2 register configuration......................................................................................... 223 8.2.3 pin functions ....................................................................................................... 227 8.3 port 2......................................................................................................................... ........ 235 8.3.1 overview.............................................................................................................. 235 8.3.2 register configuration......................................................................................... 235 8.3.3 pin functions ....................................................................................................... 238 8.4 port 3......................................................................................................................... ........ 246 8.4.1 overview.............................................................................................................. 246 8.4.2 register configuration......................................................................................... 246 8.4.3 pin functions ....................................................................................................... 249 8.5 port 4......................................................................................................................... ........ 251 8.5.1 overview.............................................................................................................. 251 8.5.2 register configuration......................................................................................... 252 8.5.3 pin functions ....................................................................................................... 252 8.6 port a......................................................................................................................... ....... 253 8.6.1 overview.............................................................................................................. 253 8.6.2 register configuration......................................................................................... 254 8.6.3 pin functions ....................................................................................................... 257 8.6.4 mos input pull-up function............................................................................... 258 8.7 port b ......................................................................................................................... ....... 259 8.7.1 overview.............................................................................................................. 259 8.7.2 register configuration......................................................................................... 260 8.7.3 pin functions ....................................................................................................... 262 8.7.4 mos input pull-up function............................................................................... 264 8.8 port c ......................................................................................................................... ....... 265 8.8.1 overview.............................................................................................................. 265 8.8.2 register configuration......................................................................................... 266 8.8.3 pin functions ....................................................................................................... 268 8.8.4 mos input pull-up function............................................................................... 270 8.9 port d......................................................................................................................... ....... 271 8.9.1 overview.............................................................................................................. 271
rev.7.00 feb. 14, 2007 page xxi of xxxii rej09b0089-0700 8.9.2 register configuration......................................................................................... 272 8.9.3 pin functions ....................................................................................................... 275 8.9.4 mos input pull-up function............................................................................... 276 8.10 port e ......................................................................................................................... ....... 277 8.10.1 overview.............................................................................................................. 277 8.10.2 register configuration......................................................................................... 278 8.10.3 pin functions ....................................................................................................... 280 8.10.4 mos input pull-up function............................................................................... 282 8.11 port f......................................................................................................................... ........ 283 8.11.1 overview.............................................................................................................. 283 8.11.2 register configuration......................................................................................... 284 8.11.3 pin functions ....................................................................................................... 290 8.12 port g......................................................................................................................... ....... 293 8.12.1 overview.............................................................................................................. 293 8.12.2 register configuration......................................................................................... 294 8.12.3 pin functions ....................................................................................................... 298 section 9 16-bit timer pulse unit (tpu)..........................................................301 9.1 overview....................................................................................................................... .... 301 9.1.1 features................................................................................................................ 301 9.1.2 block diagram..................................................................................................... 305 9.1.3 pin configuration................................................................................................. 306 9.1.4 register configuration......................................................................................... 308 9.2 register descriptions ........................................................................................................ 31 0 9.2.1 timer control registers (tcr) ........................................................................... 310 9.2.2 timer mode registers (tmdr) .......................................................................... 315 9.2.3 timer i/o control registers (tior).................................................................... 317 9.2.4 timer interrupt enable registers (tier) ............................................................ 330 9.2.5 timer status registers (tsr) .............................................................................. 333 9.2.6 timer counters (tcnt) ...................................................................................... 336 9.2.7 timer general registers (tgr)........................................................................... 337 9.2.8 timer start register (tstr)................................................................................ 337 9.2.9 timer synchro register (tsyr) ......................................................................... 338 9.2.10 module stop control register (mstpcr) .......................................................... 339 9.3 interface to bus master ..................................................................................................... 340 9.3.1 16-bit registers ................................................................................................... 340 9.3.2 8-bit registers ..................................................................................................... 340 9.4 operation...................................................................................................................... ..... 342 9.4.1 overview.............................................................................................................. 342 9.4.2 basic functions.................................................................................................... 343
rev.7.00 feb. 14, 2007 page xxii of xxxii rej09b0089-0700 9.4.3 synchronous operation........................................................................................ 349 9.4.4 buffer operation .................................................................................................. 351 9.4.5 cascaded operation ............................................................................................. 355 9.4.6 pwm modes ........................................................................................................ 357 9.4.7 phase counting mode .......................................................................................... 363 9.5 interrupts ..................................................................................................................... ...... 369 9.5.1 interrupt sources and priorities............................................................................ 369 9.5.2 dtc activation.................................................................................................... 371 9.5.3 a/d converter activation.................................................................................... 371 9.6 operation timing.............................................................................................................. 3 72 9.6.1 input/output timing ............................................................................................ 372 9.6.2 interrupt signal timing........................................................................................ 376 9.7 usage notes .................................................................................................................... .. 380 section 10 8-bit timers.....................................................................................391 10.1 overview....................................................................................................................... .... 391 10.1.1 features................................................................................................................ 391 10.1.2 block diagram..................................................................................................... 392 10.1.3 pin configuration................................................................................................. 393 10.1.4 register configuration......................................................................................... 393 10.2 register descriptions ........................................................................................................ 39 4 10.2.1 timer counters 0 and 1 (tcnt0, tcnt1) ......................................................... 394 10.2.2 time constant registers a0 and a1 (tcora0, tcora1) ............................... 394 10.2.3 time constant registers b0 and b1 (tcorb0, tcorb1) ................................ 395 10.2.4 time control registers 0 and 1 (tcr0, tcr1) .................................................. 395 10.2.5 timer control/status registers 0 and 1 (tcsr0, tcsr1).................................. 397 10.2.6 module stop control register (mstpcr) .......................................................... 400 10.3 operation...................................................................................................................... ..... 401 10.3.1 tcnt incrementation timing ............................................................................. 401 10.3.2 compare match timing ....................................................................................... 402 10.3.3 timing of tcnt external reset.......................................................................... 404 10.3.4 timing of overflow flag (ovf) setting ............................................................. 404 10.3.5 operation with cascaded connection.................................................................. 405 10.4 interrupts ..................................................................................................................... ...... 406 10.4.1 interrupt sources and dtc activation ................................................................ 406 10.4.2 a/d converter activation.................................................................................... 406 10.5 sample application........................................................................................................... 40 7 10.6 usage notes .................................................................................................................... .. 408 10.6.1 contention between tcnt write and clear........................................................ 408 10.6.2 contention between tcnt write and increment ................................................ 409
rev.7.00 feb. 14, 2007 page xxiii of xxxii rej09b0089-0700 10.6.3 contention between tcor write and compare match ...................................... 410 10.6.4 contention between compare matches a and b ................................................. 411 10.6.5 switching of internal clocks and tcnt operation............................................. 411 10.6.6 interrupts and modu le stop mode ....................................................................... 413 section 11 watchdog timer ..............................................................................415 11.1 overview....................................................................................................................... .... 415 11.1.1 features................................................................................................................ 415 11.1.2 block diagram..................................................................................................... 416 11.1.3 pin configuration................................................................................................. 417 11.1.4 register configuration......................................................................................... 417 11.2 register descriptions ........................................................................................................ 41 8 11.2.1 timer counter (tcnt)........................................................................................ 418 11.2.2 timer control/status register (tcsr)................................................................ 419 11.2.3 reset control/status register (rstcsr) ............................................................ 421 11.2.4 notes on register access..................................................................................... 422 11.3 operation...................................................................................................................... ..... 423 11.3.1 operation in watchdog timer mode ................................................................... 423 11.3.2 operation in interval timer mode ....................................................................... 425 11.3.3 timing of overflow flag (ovf) setting ............................................................. 426 11.3.4 timing of watchdog timer overflow flag (wovf) setting.............................. 427 11.4 interrupts ..................................................................................................................... ...... 428 11.5 usage notes .................................................................................................................... .. 428 11.5.1 contention between timer counter (tcnt) write and increment ..................... 428 11.5.2 changing value of cks2 to cks0...................................................................... 429 11.5.3 switching between watchdog timer mode and interval timer mode................ 429 11.5.4 system reset by wdtovf signal...................................................................... 429 11.5.5 internal reset in watchdog timer mode............................................................. 430 section 12 serial comm unication interface (sci) ............................................431 12.1 overview....................................................................................................................... .... 431 12.1.1 features................................................................................................................ 431 12.1.2 block diagram..................................................................................................... 433 12.1.3 pin configuration................................................................................................. 434 12.1.4 register configuration......................................................................................... 435 12.2 register descriptions ........................................................................................................ 43 6 12.2.1 receive shift register (rsr) .............................................................................. 436 12.2.2 receive data register (rdr) .............................................................................. 436 12.2.3 transmit shift register (tsr) ............................................................................. 437 12.2.4 transmit data register (tdr)............................................................................. 437
rev.7.00 feb. 14, 2007 page xxiv of xxxii rej09b0089-0700 12.2.5 serial mode register (smr)................................................................................ 438 12.2.6 serial control register (scr).............................................................................. 441 12.2.7 serial status re gister (ssr) ................................................................................ 445 12.2.8 bit rate register (brr) ...................................................................................... 449 12.2.9 smart card mode register (scmr) .................................................................... 457 12.2.10 module stop control register (mstpcr) .......................................................... 459 12.3 operation...................................................................................................................... ..... 460 12.3.1 overview.............................................................................................................. 460 12.3.2 operation in asynchronous mode ....................................................................... 462 12.3.3 multiprocessor communication function............................................................ 473 12.3.4 operation in synchronous mode ......................................................................... 481 12.4 sci interrupts................................................................................................................. ... 490 12.5 usage notes .................................................................................................................... .. 491 section 13 smart card interface........................................................................499 13.1 overview....................................................................................................................... .... 499 13.1.1 features................................................................................................................ 499 13.1.2 block diagram..................................................................................................... 500 13.1.3 pin configuration................................................................................................. 501 13.1.4 register configuration......................................................................................... 502 13.2 register descriptions ........................................................................................................ 50 3 13.2.1 smart card mode register (scmr) .................................................................... 503 13.2.2 serial status re gister (ssr) ................................................................................ 504 13.2.3 serial mode register (smr)................................................................................ 506 13.2.4 serial control register (scr).............................................................................. 508 13.3 operation...................................................................................................................... ..... 509 13.3.1 overview.............................................................................................................. 509 13.3.2 pin connections ................................................................................................... 510 13.3.3 data format ......................................................................................................... 511 13.3.4 register settings .................................................................................................. 513 13.3.5 clock.................................................................................................................... 515 13.3.6 data transfer operations ..................................................................................... 517 13.3.7 operation in gsm mode ..................................................................................... 525 13.3.8 operation in block transfer mode ...................................................................... 526 13.4 usage notes .................................................................................................................... .. 526 section 14 a/d converter (8 an alog input channel version) .........................531 14.1 overview....................................................................................................................... .... 531 14.1.1 features................................................................................................................ 531 14.1.2 block diagram..................................................................................................... 532
rev.7.00 feb. 14, 2007 page xxv of xxxii rej09b0089-0700 14.1.3 pin configuration................................................................................................. 533 14.1.4 register configuration......................................................................................... 534 14.2 register descriptions ........................................................................................................ 53 5 14.2.1 a/d data registers a to d (addra to addrd) ............................................. 535 14.2.2 a/d control/status register (adcsr) ............................................................... 536 14.2.3 a/d control register (adcr) ............................................................................ 538 14.2.4 module stop control register (mstpcr) .......................................................... 539 14.3 interface to bus master ..................................................................................................... 540 14.4 operation...................................................................................................................... ..... 541 14.4.1 single mode (scan = 0) .................................................................................... 541 14.4.2 scan mode (scan = 1)....................................................................................... 543 14.4.3 input sampling and a/d conversion time.......................................................... 545 14.4.4 external trigger input timing............................................................................. 546 14.5 interrupts ..................................................................................................................... ...... 547 14.6 usage notes .................................................................................................................... .. 548 section 15 d/a converter..................................................................................553 15.1 overview....................................................................................................................... .... 553 15.1.1 features................................................................................................................ 553 15.1.2 block diagram..................................................................................................... 554 15.1.3 pin configuration................................................................................................. 555 15.1.4 register configuration......................................................................................... 555 15.2 register descriptions ........................................................................................................ 55 6 15.2.1 d/a data registers 0, 1 (dadr0, dadr1) ....................................................... 556 15.2.2 d/a control registers 01 (dacr01) .................................................................. 556 15.2.3 module stop control register (mstpcr) .......................................................... 558 15.3 operation...................................................................................................................... ..... 559 section 16 ram ................................................................................................561 16.1 overview....................................................................................................................... .... 561 16.1.1 block diagram..................................................................................................... 561 16.1.2 register configuration......................................................................................... 562 16.2 register descriptions ........................................................................................................ 56 2 16.2.1 system control register (syscr) ...................................................................... 562 16.3 operation...................................................................................................................... ..... 563 16.4 usage note..................................................................................................................... ... 563 section 17 rom ................................................................................................565 17.1 overview....................................................................................................................... .... 565 17.1.1 block diagram..................................................................................................... 565
rev.7.00 feb. 14, 2007 page xxvi of xxxii rej09b0089-0700 17.1.2 register configuration......................................................................................... 566 17.2 register descriptions ........................................................................................................ 56 6 17.2.1 mode control register (mdcr) ......................................................................... 566 17.2.2 bus control regist er l ( bcrl) .......................................................................... 567 17.3 operation...................................................................................................................... ..... 567 17.4 overview of flash memory (h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, h8 s/2314 f-zt at).......................................................................... 571 17.4.1 features................................................................................................................ 571 17.4.2 overview.............................................................................................................. 572 17.4.3 flash memory operating modes ......................................................................... 573 17.4.4 on-board progra mming modes........................................................................... 574 17.4.5 flash memory emulation in ram ...................................................................... 576 17.4.6 differences between boot mode and user program mode ................................. 577 17.4.7 block configuration............................................................................................. 578 17.4.8 pin configuration................................................................................................. 579 17.4.9 register configuration......................................................................................... 580 17.5 register descriptions ........................................................................................................ 58 1 17.5.1 flash memory control register 1 (flmcr1)..................................................... 581 17.5.2 flash memory control register 2 (flmcr2)..................................................... 584 17.5.3 erase block regist er 1 (e br1) ........................................................................... 585 17.5.4 erase block regist er 2 (e br2) ........................................................................... 585 17.5.5 system control register 2 (syscr2) ................................................................. 586 17.5.6 ram emulation register (ramer)................................................................... 587 17.6 on-board programming modes........................................................................................ 589 17.6.1 boot mo de ........................................................................................................... 590 17.6.2 user program mode............................................................................................. 595 17.7 programming/erasing flash memory ............................................................................... 597 17.7.1 program mode ..................................................................................................... 597 17.7.2 program-verify mode.......................................................................................... 598 17.7.3 erase mode .......................................................................................................... 600 17.7.4 erase-verify mode............................................................................................... 600 17.8 flash memory protection.................................................................................................. 602 17.8.1 hardware protection ............................................................................................ 602 17.8.2 software protection.............................................................................................. 602 17.8.3 error protection.................................................................................................... 603 17.9 flash memory emulation in ram ................................................................................... 605 17.9.1 emulation in ram............................................................................................... 605 17.9.2 ram overlap ...................................................................................................... 606 17.10 interrupt handling when programming/erasing flash memory....................................... 607 17.11 flash memory programmer mode .................................................................................... 608
rev.7.00 feb. 14, 2007 page xxvii of xxxii rej09b0089-0700 17.11.1 progremmer mode setting ................................................................................... 608 17.11.2 socket adapters and memory map...................................................................... 609 17.11.3 programmer mode operation .............................................................................. 611 17.11.4 memory read mode ............................................................................................ 613 17.11.5 auto-program mode ............................................................................................ 616 17.11.6 auto-erase mode ................................................................................................. 618 17.11.7 status read mode ................................................................................................ 620 17.11.8 status po lling ....................................................................................................... 621 17.11.9 programmer mode transition time..................................................................... 622 17.11.10 notes on me mory prog ramming........................................................................ 623 17.12 flash memory programming and erasing precautions ..................................................... 623 17.13 overview of flash memory (h8s/2319 f-ztat)............................................................ 629 17.13.1 features................................................................................................................ 629 17.13.2 overview.............................................................................................................. 630 17.13.3 flash memory operating modes ......................................................................... 631 17.13.4 on-board progra mming modes........................................................................... 632 17.13.5 flash memory emulation in ram ...................................................................... 634 17.13.6 differences between boot mode and user program mode ................................. 635 17.13.7 block configuration............................................................................................. 636 17.13.8 pin configuration................................................................................................. 637 17.13.9 register configuration......................................................................................... 638 17.14 register descriptions ........................................................................................................ 63 9 17.14.1 flash memory control register 1 (flmcr1)..................................................... 639 17.14.2 flash memory control register 2 (flmcr2)..................................................... 642 17.14.3 erase block regist er 1 (e br1) ........................................................................... 645 17.14.4 erase block regist er 2 (e br2) ........................................................................... 646 17.14.5 system control register 2 (syscr2) ................................................................. 647 17.14.6 ram emulation register (ramer)................................................................... 647 17.15 on-board programming modes........................................................................................ 649 17.15.1 boot mo de ........................................................................................................... 650 17.15.2 user program mode............................................................................................. 654 17.16 programming/erasing flash memory ............................................................................... 656 17.16.1 program mode (n = 1 for a ddresses h'000000 to h'03ffff, and n = 2 for addre sses h'040000 to h'07ffff) ................................................. 656 17.16.2 program-verify mode (n = 1 fo r addresses h'000000 to h'03ffff, and n = 2 for addre sses h'040000 to h'07ffff) ................................................. 657 17.16.3 erase mode (n = 1 for a ddresses h'000000 to h'03ffff, and n = 2 for addre sses h'040000 to h'07ffff) ................................................. 659 17.16.4 erase-verify mode (n = 1 fo r addresses h'000000 to h'03ffff, and n = 2 for addre sses h'040000 to h'07ffff) ................................................. 660
rev.7.00 feb. 14, 2007 page xxviii of xxxii rej09b0089-0700 17.17 flash memory protection.................................................................................................. 662 17.17.1 hardware protection ............................................................................................ 662 17.17.2 software protection.............................................................................................. 663 17.17.3 error protection.................................................................................................... 664 17.18 flash memory emulation in ram ................................................................................... 666 17.18.1 emulation in ram............................................................................................... 666 17.18.2 ram overlap ...................................................................................................... 667 17.19 interrupt handling when programming/erasing flash memory....................................... 668 17.20 flash memory programmer mode .................................................................................... 669 17.20.1 programmer mode setting ................................................................................... 669 17.20.2 socket adapters and memory map...................................................................... 670 17.20.3 programmer mode operation .............................................................................. 672 17.20.4 memory read mode ............................................................................................ 673 17.20.5 auto-program mode ............................................................................................ 677 17.20.6 auto-erase mode ................................................................................................. 679 17.20.7 status read mode ................................................................................................ 680 17.20.8 status po lling ....................................................................................................... 681 17.20.9 programmer mode transition time..................................................................... 682 17.20.10 notes on memo ry programming........................................................................ 682 17.21 flash memory programming and erasing precautions ..................................................... 684 17.22 overview of flash memory (h8s/2319c 0.18m f-ztat)............................................ 686 17.22.1 features................................................................................................................ 686 17.22.2 overview.............................................................................................................. 688 17.22.3 operating mode of flash memory....................................................................... 689 17.22.4 mode comparison................................................................................................ 690 17.22.5 flash mat configuration.................................................................................... 691 17.22.6 block division ..................................................................................................... 692 17.22.7 programming/erasing interface ........................................................................... 693 17.22.8 pin configuration................................................................................................. 695 17.22.9 register configuration......................................................................................... 695 17.23 register description of flash memory ............................................................................. 697 17.23.1 programming/erasing interface register ............................................................. 697 17.23.2 programming/erasing interface parameter .......................................................... 704 17.23.3 system control register 2 (syscr2) ................................................................. 717 17.23.4 ram emulation register (ramer)................................................................... 718 17.24 on-board programming mode ......................................................................................... 720 17.24.1 boot mo de ........................................................................................................... 720 17.24.2 user program mode............................................................................................. 724 17.24.3 user boot mode................................................................................................... 734 17.25 protection ..................................................................................................................... ..... 738
rev.7.00 feb. 14, 2007 page xxix of xxxii rej09b0089-0700 17.25.1 hardware protection ............................................................................................ 738 17.25.2 software protection.............................................................................................. 739 17.25.3 error protection.................................................................................................... 739 17.26 flash memory emulation in ram ................................................................................... 741 17.27 switching between user mat and user boot mat ........................................................ 744 17.27.1 usage notes ......................................................................................................... 745 17.28 prom mode..................................................................................................................... 7 46 17.28.1 pin arrangement of the socket adapter .............................................................. 747 17.28.2 prom mode operation....................................................................................... 749 17.28.3 memory-read mode............................................................................................ 750 17.28.4 auto-program mode ............................................................................................ 751 17.28.5 auto-erase mode ................................................................................................. 751 17.28.6 status-read mode................................................................................................ 752 17.28.7 status po lling ....................................................................................................... 752 17.28.8 time taken in transition to prom mode .......................................................... 753 17.28.9 notes on using prom mode .............................................................................. 753 17.29 further information........................................................................................................... 7 54 17.29.1 serial communication interface specification for boot mode............................ 754 17.29.2 ac characteristics and timing in prom mode ................................................. 781 17.29.3 procedure program and storable area for programming data ............................ 787 section 18 clock pulse generator .....................................................................793 18.1 overview....................................................................................................................... .... 793 18.1.1 block diagram..................................................................................................... 793 18.1.2 register configuration......................................................................................... 794 18.2 register descriptions ........................................................................................................ 79 4 18.2.1 system clock control register (sckcr) ........................................................... 794 18.3 oscilla tor..................................................................................................................... ...... 796 18.3.1 connecting a crystal resonator........................................................................... 796 18.3.2 external clock input ............................................................................................ 798 18.4 duty adjustment circuit ................................................................................................... 800 18.5 medium-speed clock divider .......................................................................................... 800 18.6 bus master clock selection circuit .................................................................................. 800 section 19 power-down modes ........................................................................801 19.1 overview....................................................................................................................... .... 801 19.1.1 register configuration......................................................................................... 802 19.2 register descriptions ........................................................................................................ 80 3 19.2.1 standby control register (sbycr) .................................................................... 803 19.2.2 system clock control register (sckcr) ........................................................... 805
rev.7.00 feb. 14, 2007 page xxx of xxxii rej09b0089-0700 19.2.3 module stop control register (mstpcr) .......................................................... 807 19.3 medium-speed mode ........................................................................................................ 807 19.4 sleep mode ..................................................................................................................... .. 808 19.5 module st op mode ............................................................................................................ 809 19.5.1 module stop mode .............................................................................................. 809 19.5.2 usage notes ......................................................................................................... 810 19.6 software standby mode.................................................................................................... 811 19.6.1 software standby mode....................................................................................... 811 19.6.2 clearing software standby mode ........................................................................ 811 19.6.3 setting oscillation stabilization time after clearing software standby mode... 812 19.6.4 software standby mode application example.................................................... 812 19.6.5 usage notes ......................................................................................................... 813 19.7 hardware standby mode .................................................................................................. 814 19.7.1 hardware standby mode ..................................................................................... 814 19.7.2 hardware standby mode timing......................................................................... 814 19.8 clock output disabling function .................................................................................. 815 section 20 electrical characteristics .................................................................817 20.1 electrical characteristics of mask rom version (h8s/2319, h8s/2318, h8s/2317s, h8s/2316s, h8s/2315, h8s/2314) an d romless version (h8s/2312s) ........................ 817 20.1.1 absolute maximum ratings ................................................................................ 817 20.1.2 dc characteristics ............................................................................................... 818 20.1.3 ac characteristics ............................................................................................... 820 20.1.4 a/d conversion characteristics........................................................................... 838 20.1.5 d/a conversion characteristics........................................................................... 839 20.2 electrical characteristics of f-ztat versions (h8s/2319 f-ztat, h8s/2319e f-ztat, h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, h8s/2314 f- ztat) .......................................................................................................... 840 20.2.1 absolute maximum ratings ................................................................................ 840 20.2.2 dc characteristics ............................................................................................... 841 20.2.3 ac characteristics ............................................................................................... 844 20.2.4 a/d conversion characteristics........................................................................... 848 20.2.5 d/a conversion characteristics........................................................................... 848 20.2.6 flash memory characteristics ............................................................................. 849 20.3 electrical characteristics of f-ztat version (h8s/2319c f-ztat) ............................. 851 20.3.1 absolute maximum ratings ................................................................................ 851 20.3.2 dc characteristics ............................................................................................... 852 20.3.3 ac characteristics ............................................................................................... 855 20.3.4 a/d conversion characteristics........................................................................... 859 20.3.5 d/a conversion characteristics........................................................................... 859
rev.7.00 feb. 14, 2007 page xxxi of xxxii rej09b0089-0700 20.3.6 flash memory characteristics ............................................................................. 860 20.3.7 usage note (internal voltage step down for the h8s/2319c f-ztat) ............... 861 20.4 usage note..................................................................................................................... ... 861 appendix a instruction set ...............................................................................863 a.1 instruction list ............................................................................................................... ... 863 a.2 instruction codes .............................................................................................................. 887 a.3 operation code map......................................................................................................... 902 a.4 number of states required for instruction execution ...................................................... 906 a.5 bus states during instruction execution ........................................................................... 920 a.6 condition code modification ........................................................................................... 934 appendix b internal i/o registers ....................................................................940 b.1 list of registers (address order) ..................................................................................... 940 b.2 list of registers (by module)........................................................................................... 949 b.3 functions...................................................................................................................... ..... 958 appendix c i/o port block diagrams ........................................................... 1069 c.1 port 1......................................................................................................................... .... 1069 c.2 port 2......................................................................................................................... .... 1073 c.3 port 3......................................................................................................................... .... 1074 c.4 port 4......................................................................................................................... .... 1077 c.5 port a......................................................................................................................... ... 1078 c.6 port b ......................................................................................................................... ... 1079 c.7 port c ......................................................................................................................... ... 1080 c.8 port d......................................................................................................................... ... 1081 c.9 port e ......................................................................................................................... ... 1082 c.10 port f......................................................................................................................... .... 1083 c.11 port g......................................................................................................................... ... 1091 appendix d pin states ................................................................................... 1096 d.1 port states in each mode .............................................................................................. 1096 appendix e product lineup........................................................................... 1103 appendix f package dimensions .................................................................. 1105
rev.7.00 feb. 14, 2007 page xxxii of xxxii rej09b0089-0700
section 1 overview rev.7.00 feb. 14, 2007 page 1 of 1108 rej09b0089-0700 section 1 overview 1.1 overview the h8s/2319 group is a series of microcomputer (mcu: microcomputer unit), built around the h8s/2000 cpu, employing renesas's proprietary architecture, and equipped with supporting functions on-chip. the h8s/2000 cpu has an internal 32-bit architect ure, is provided with sixteen 16-bit general registers and a concise, optimized instruction set designed for high-speed operation, and can address a 16-mbyte linear address space. the instruction set is upward-compatible with h8/300 and h8/300h cpu instructions at the object-code level, facilitating migration from the h8/300, h8/300l, or h8/300h series. on-chip supporting functions required for system configuration include data transfer controller (dtc) bus masters, rom and ram, a 16-bit timer-pulse unit (tpu), 8-bit timer, watchdog timer (wdt), serial communication interface (sci), a/d converter, d/a converter, and i/o ports. single-power-supply flash memory (f-ztat? * ) and mask rom versions are available, providing a quick and flexible response to conditions from ramp-up through full-scale volume production, even for applications with frequent ly changing specifications. rom is connected to the cpu via a 16-bit data bus, enabling both byte and word data to be accessed in one state. instruction fetching is thus speeded up, and processing speed increased. the features of the h8s/2319 group are shown in table 1.1. note: * f-ztat is a trademark of renesas technology corp.
section 1 overview rev.7.00 feb. 14, 2007 page 2 of 1108 rej09b0089-0700 table 1.1 overview item specification cpu ? general-register machine ? sixteen 16-bit general registers (also usable as sixteen 8-bit registers or eight 32-bit registers) ? high-speed operation suitable for realtime control ? maximum clock rate: 25 mhz ? high-speed arithmetic operations 8/16/32-bit register-register add/subtract: 40 ns (at 25-mhz operation) 16 16-bit register-register multiply: 800 ns (at 25-mhz operation) 32 16-bit register-register divide: 800 ns (at 25-mhz operation) ? instruction set suitable for high-speed operation ? sixty-five basic instructions ? 8/16/32-bit move/arithmetic and logic instructions ? unsigned/signed multiply and divide instructions ? powerful bit-manipulation instructions ? cpu operating mode ? advanced mode: 16-mbyte address space bus controller ? address space divided into 8 areas, with bus specifications settable independently for each area ? chip select output possible for each area ? choice of 8-bit or 16-bit access space for each area ? 2-state or 3-state access space can be designated for each area ? number of program wait states can be set for each area ? burst rom directly connectable ? external bus release function data transfer controller (dtc) ? can be activated by internal interrupt or software ? multiple transfers or multiple types of transfer possible for one activation source ? transfer possible in repeat mode, block transfer mode, etc. ? request can be sent to cpu for interrupt that activated dtc 16-bit timer-pulse unit (tpu) ? 6-channel 16-bit timer ? pulse i/o processing capability for up to 16 pins ? automatic 2-phase encoder count capability
section 1 overview rev.7.00 feb. 14, 2007 page 3 of 1108 rej09b0089-0700 item specification 8-bit timer, 2 channels ? 8-bit up-counter (external event count capability) ? two time constant registers ? two-channel connection possible watchdog timer ? watchdog timer or interval timer selectable serial communication interface (sci), 2 channels ? asynchronous mode or synchronous mode selectable ? multiprocessor communication function ? smart card interface function a/d converter ? resolution: 10 bits ? input: 8 channels ? high-speed conversion: 6.7 s minimum conversion time (at 20-mhz operation) ? single or scan mode selectable ? sample-and-hold circuit ? a/d conversion can be activated by external trigger or timer trigger d/a converter ? resolution: 8 bits ? output: 2 channels i/o ports ? 70 input/output pins, 9 input pins memory ? flash memory, mask rom ? high-speed static ram product name rom ram h8s/2319c 512 kbytes 16 kbytes h8s/2319 512 kbytes 8 kbytes h8s/2318 256 kbytes 8 kbytes h8s/2317(s) * 128 kbytes 8 kbytes h8s/2316s 64 kbytes 8 kbytes h8s/2315 384 kbytes 8 kbytes h8s/2314 384 kbytes 4 kbytes h8s/2312s ? 8 kbytes note: * h8s/2317s in mask rom version. interrupt controller ? 9 external interrupt pins (nmi, irq0 to irq7 ) ? 43 internal interrupt sources ? eight priority levels settable
section 1 overview rev.7.00 feb. 14, 2007 page 4 of 1108 rej09b0089-0700 item specification power-down state ? medium-speed mode ? sleep mode ? module stop mode ? software standby mode ? hardware standby mode ? variable clock division ratio operating modes ? eight mcu operating modes (h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, h8s/2314 f-ztat) external data bus mode cpu operating mode description on-chip rom initial value maximum value 1 ? ? ? ? ? 2 3 4 advanced disabled 16 bits 16 bits 5 on-chip rom disabled expansion mode 8 bits 16 bits 6 on-chip rom enabled expansion mode enabled 8 bits 16 bits 7 single-chip mode ? ? 8 ? ? ? ? ? 9 10 advanced boot mode enabled 8 bits 16 bits 11 ? ? 12 ? ? ? ? ? 13 14 advanced user program mode enabled 8 bits 16 bits 15 ? ?
section 1 overview rev.7.00 feb. 14, 2007 page 5 of 1108 rej09b0089-0700 item specification operating modes ? four mcu operating modes (romless, mask rom versions, h8s/2319 f- ztat, and h8s/2319c f-ztat) external data bus mode cpu operating mode description on-chip rom initial value maximum value 1 * 1 ? ? ? ? ? 2 * 2 3 * 2 4 * 3 advanced on-chip rom disabled expansion mode disabled 16 bits 16 bits 5 * 3 on-chip rom disabled expansion mode disabled 8 bits 16 bits 6 on-chip rom enabled expansion mode enabled 8 bits 16 bits 7 single-chip mode enabled ? ? notes: 1. user boot mode in the h8s/2319c f-ztat. for user boot mode in the h8s/2319c f-ztat, see table 17.52. 2. boot mode in the h8s/2319 f-ztat and h8s/2319c f-ztat. for boot mode in the h8s/2319 f-ztat, see table 17.30. also see table 17.30, for information on user program mode. for boot mode in the h8s/2319c f-ztat, see table 17.52. also see table 17.52, for information on user program mode. 3. the romless version can use only modes 4 and 5. clock pulse generator ? built-in duty correction circuit
section 1 overview rev.7.00 feb. 14, 2007 page 6 of 1108 rej09b0089-0700 item specification product lineup condition a condition b operating power supply voltage 2.7 to 3.6 v 3.0 to 3.6 v operating frequency 2 to 20 mhz 2 to 25 mhz model hd64f2319 ? o hd64f2319e * ? o hd64f2319c ? o hd6432319 o o hd64f2318 ? o hd6432318 o o hd64f2317 ? o hd6432317s o o hd6432316s o o hd64f2315 ? o hd6432315 o o hd64f2314 ? o hd6432314 o o hd6412312s o o o: products in the current lineup note: * the on-chip debug function can be used with the e10a emulator (e10a compatible version). however, some function modules and pin functions are unavailable when the on-chip debug function is in use. refer to figure 1.4 and figure 1.5. (the sci channel 1 is unavailable when the on-chip debug function is in use. also, since the wdt continues to operate during break status, a reset is generated when an overflow occurs if a setting is made to reset the chip internally.)
section 1 overview rev.7.00 feb. 14, 2007 page 7 of 1108 rej09b0089-0700 item specification other features ? differences between h8s/2319 f-ztat and h8s/2319c f-ztat ? on-chip ram h8s/2319 f-ztat: 8 kbytes (h'ffdc00 to h'fffbff) h8s/2319c f-ztat: 16 kbytes (h'ffbc00 to h'fffbff) ? on-chip flash memory the h8s/2319 f-ztat and h8s/2319c f-ztat both have 512 kbytes of on-chip flash memory. however, the method for controlling the flash memory is different for the two lsis. when the on-chip flash memory is enabled, the registers (parameters) used to control it are different. for details, see the section about the h8s/2319 f-ztat and h8s/2319c f-ztat in section 17, rom. ? address map the address maps of the h8s/2319 f-ztat and h8s/2319c f-ztat differ in places. for details, see section 3.5, memory map in each operating mode.
section 1 overview rev.7.00 feb. 14, 2007 page 8 of 1108 rej09b0089-0700 1.2 block diagram pe7/ d7 pe6/ d6 pe5/ d5 pe4/ d4 pe3/ d3 pe2/ d2 pe1/ d1 pe0/ d0 internal data bus peripheral data bus peripheral address bus pd7/ d15 pd6/ d14 pd5/ d13 pd4/ d12 pd3/ d11 pd2/ d10 pd1/ d9 pd0/ d8 port d v cc v cc v cc v ss v ss v ss v ss v ss v ss port a pa3/ a19 pa2/ a18 pa1/ a17 pa0/ a16 pb7/ a15 pb6/ a14 pb5/ a13 pb4/ a12 pb3/ a11 pb2/ a10 pb1/ a9 pb0/ a8 pc7/ a7 pc6/ a6 pc5/ a5 pc4/ a4 pc3/ a3 pc2/ a2 pc1/ a1 pc0/ a0 port b port c port 3 p35/ sck1/ irq 5 p34/ sck0/ irq 4 p33/ rxd1 p32/ rxd0 p31/ txd1 p30/ txd0 p47/ an7/ da1 p46/ an6/ da0 p45/ an5 p44/ an4 p43/ an3 p42/ an2 p41/ an1 p40/ an0 v ref av cc av ss p20/ tioca3 p21/ tiocb3 p22/ tiocc 3/tmri0 p23/ tiocd 3/tmci0 p24/ tioca 4/tmri1 p25/ tiocb 4/tmci1 p26/ tioca 5/tmo0 p27/ tiocb 5/tmo1 p10/ tioca 0/a20 p11/ tiocb 0/a21 p12/ tiocc0 / tclka/a22 p13/ tiocd0 / tclkb/a23 p14/ tioca1 p15/ tiocb1 / tclkc p16/ tioca2 p17/ tiocb2 / tclkd pg4/ cs0 pg3/ cs1 / cs7 pg2/ cs2 pg1/ cs3 / irq7 / cs6 pg0/ adtrg / irq6 port g pf7/ pf6/ as pf5/ rd pf4/ hwr pf3/ lwr / irq3 pf2/ wait / irq2 / dreqo pf1/ back / irq1 / cs5 pf0/ breq / irq0 / cs4 port f clock pulse generator rom * 2 ram tpu sci md2 md1 md0 extal xtal stby res wdtovf (fwe, emle, v cl ) * 1 nmi h8s/2000 cpu dtc interrupt controller port e port 4 port 2 port 1 internal address bus wdt 8-bit timer d/a converter a/d converter bus controller notes: 1. the fwe pin function is only available in the h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat. the emle pin function is only available in the h8s/2319 f-ztat. the v cl pin function is only available in the h8s/2319c f-ztat. the wdtovf pin function is not available in the f-ztat versions. 2. rom is not supported in the romless versions. figure 1.1 block diagram
section 1 overview rev.7.00 feb. 14, 2007 page 9 of 1108 rej09b0089-0700 1.3 pin description 1.3.1 pin arrangement 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 p12/tiocc0/tclka/a22 p13/tiocd0/tclkb/a23 p14/tioca1 p15/tiocb1/tclkc p16/tioca2 p17/tiocb2/tclkd v ss p30/txd0 p31/txd1 p32/rxd0 p33/rxd1 p34/sck0/ irq4 p35/sck1/ irq5 pe0/d0 pe1/d1 pe2/d2 pe3/d3 v ss pe4/d4 pe5/d5 pe6/d6 pe7/d7 pd0/d8 pd1/d9 pd2/d10 pf1/ back / irq1 / cs5 pf2/ wait / irq2 / breqo pf3/ lwr / irq3 pf4/ hwr pf5/ rd pf6/ as pf7/ v ss extal xtal v cc stby nmi res md2 wdtovf (fwe, emle, v cl ) * p23/tiocd3/tmci0 md1 md0 p22/tiocc3/tmri0 p21/tiocb3 p20/tioca3 pa3/a19 pa2/a18 pa1/a17 pa0/a16 v ss pb7/a15 pb6/a14 pb5/a13 pb4/a12 pb3/a11 pb2/a10 pb1/a9 pb0/a8 v cc pc7/a7 pc6/a6 pc5/a5 pc4/a4 pc3/a3 pc2/a2 pc1/a1 pc0/a0 v ss pd7/d15 pd6/d14 pd5/d13 pd4/d12 pd3/d11 pf0/ breq / irq0 / cs4 av cc v ref p40/an0 p41/an1 p42/an2 p43/an3 p44/an4 p45/an5 p46/an6/da0 p47/an7/da1 av ss v ss p24/tioca4/tmri1 p25/tiocb4/tmci1 p26/tioca5/tmo0 p27/tiocb5/tmo1 pg0/ adtrg / irq6 pg1/ cs3 / irq7 / cs6 pg2/ cs2 pg3/ cs1 / cs7 pg4/ cs0 v cc p10/tioca0/a20 p11/tiocb0/a21 note: * the fwe pin function is only available in the h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat. the emle pin function is only available in the h8s/2319 f-ztat. the v cl pin function is only available in the h8s/2319c f-ztat. the wdtovf pin function is not available in the f-ztat versions. figure 1.2 pin arrangement (tfp-100b, tfp-100g: top view)
section 1 overview rev.7.00 feb. 14, 2007 page 10 of 1108 rej09b0089-0700 p10/tioca0/a20 p11/tiocb0/a21 p12/tiocc0/tclka/a22 p13/tiocd0/tclkb/a23 p14/tioca1 p15/tiocb1/tclkc p16/tioca2 p17/tiocb2/tclkd v ss p30/txd0 p31/txd1 p32/rxd0 p33/rxd1 p34/sck0/ irq4 p35/sck1/ irq5 pe0/d0 pe1/d1 pe2/d2 pe3/d3 v ss pe4/d4 pe5/d5 pe6/d6 pe7/d7 pd0/d8 pd1/d9 pd2/d10 pd3/d11 pd4/d12 pd5/d13 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 v ref av cc pf0/ breq / irq0 / cs4 pf1/ back / irq1 / cs5 pf2/ wait / irq2 / breqo pf3/ lwr / irq3 pf4/ hwr pf5/ rd pf6/ as pf7/ v ss extal xtal v cc stby nmi res md2 wdtovf (fwe, emle , v cl ) * p23/tiocd3/tmci0 md1 md0 p22/tiocc3/tmri0 p21/tiocb3 p20/tioca3 pa3/a19 pa2/a18 pa1/a17 pa0/a16 v ss 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 pb7/a15 pb6/a14 pb5/a13 pb4/a12 pb3/a11 pb2/a10 pb1/a9 pb0/a8 v cc pc7/a7 pc6/a6 pc5/a5 pc4/a4 pc3/a3 pc2/a2 pc1/a1 pc0/a0 v ss pd7/d15 pd6/d14 p40/an0 p41/an1 p42/an2 p43/an3 p44/an4 p45/an5 p46/an6/da0 p47/an7/da1 av ss v ss p24/tioca4/tmri1 p25/tiocb4/tmci1 p26/tioca5/tmo0 p27/tiocb5/tmo1 pg0/ adtrg / irq6 pg1/ cs3 / irq7 / cs6 pg2/ cs2 pg3/ cs1 / cs7 pg4/ cs0 v cc 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 note: * the fwe pin function is only available in the h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat. the emle pin function is only available in the h8s/2319 f-ztat. the v cl pin function is only available in the h8s/2319c f-ztat. the wdtovf pin function is not available in the f-ztat versions. figure 1.3 pin arrangement (fp-100a: top view)
section 1 overview rev.7.00 feb. 14, 2007 page 11 of 1108 rej09b0089-0700 1 2 3 4 5 6 7 8 9 10 11 12 13 1 4 15 16 17 18 19 20 21 22 23 2 4 25 75 7 4 73 72 71 70 69 68 67 66 65 6 4 63 62 61 60 59 58 57 56 55 5 4 53 52 51 50 4 9 4 8 4 7 4 6 4 5 44 4 3 4 2 4 1 4 0 39 38 37 36 35 3 4 33 32 31 30 29 28 27 26 76 77 78 79 80 81 82 83 8 4 85 86 87 88 89 90 91 92 93 9 4 95 96 97 98 99 100 p12 /ti occ0 /t c lk a / a22 p13 /ti ocd0 /t c lk b / a23 p1 4/ti oca1 p15 /ti ocb1 /t c lk c p16 /ti oca2 p17 /ti ocb2 /t c lk d v ss p30 /t xd0 p31 /t xd1 /t do * p32 / rxd0 p33 / rxd1 /t d i * p3 4/ sc k 0 / i rq 4 p35 / sc k 1 / i rq 5 /t c k * p e 0 / d0 p e 1 / d1 p e 2 / d2 p e 3 / d3 v ss p e4/ d 4 p e 5 / d5 p e 6 / d6 p e 7 / d7 pd0 / d8 pd1 / d9 pd2 / d10 p f 1 / b a ck / i rq 1 / cs 5 p f 2 / w ait / i rq2 / br e qo p f 3 / l wr / i rq3 p f4/ h wr p f 5 / rd p f 6 / a s p f 7 / v ss e x t a l x t a l v cc s t by n m i r e s md2 e m le * p23 /ti ocd3 /t mc i 0 md1 md0 p22 /ti occ3 /t mr i 0 p21 /ti ocb3 / t rs t * p20 /ti oca3 /t ms * pa3 / a19 pa2 / a18 pa1 / a17 pa0 / a16 v ss pb7 / a15 pb6 / a1 4 pb5 / a13 pb 4/ a12 pb3 / a11 pb2 / a10 pb1 / a9 pb0 / a8 v cc pc7 / a7 pc6 / a6 pc5 / a5 pc 4/ a 4 pc3 / a3 pc2 / a2 pc1 / a1 pc0 / a0 v ss pd7 / d15 pd6 / d1 4 pd5 / d13 pd 4/ d12 pd3 / d11 p f 0 / br e q / i rq0 / cs 4 av cc v ref p 4 0 / a n 0 p 4 1 / a n 1 p 4 2 / a n 2 p 4 3 / a n 3 p 44/ a n4 p 4 5 / a n 5 p 4 6 / a n 6 / da0 p 4 7 / a n 7 / da1 av ss v ss p2 4/ti oca 4/t mr i 1 p25 /ti ocb 4/t mc i 1 p26 /ti oca5 /t mo0 p27 /ti ocb5 /t mo1 pg0 / a d t rg / i rq6 pg1 / cs3 / i rq7 / cs6 pg2 / cs2 pg3 / cs 1 / cs7 pg 4/ cs0 v cc p10 /ti oca0 / a20 p11 /ti ocb0 / a21 n ote : * i f an e 10a emu l ator i s used, the t do, t d i , t d k , t ms, and t rs t p i ns are used exc l us i ve l y for the h- ud i and the funct i ons and funct i on modu l es assoc i ated wi th these p i ns are not ava il ab l e . ( t he sc i channe l 1 i s unava il ab l e w hen the on - ch i p debug funct i on i s i n use . a l so, s i nce the wd t cont i nues to operate dur i ng break status, a reset i s generated w hen an overf l o w occurs i f a sett i ng i s made to reset the ch i p i nterna ll y . ) refer to the h 8s, h 8sx f am ili y e 10a - usb e mu l ator user ' s manua l for e 10a emu l ator connect i on examp l es . refer to the h 8s / 2319 f- z t a t sect i on for h d6 4f 2319 e. e10a compatible version figure 1.4 hd64f2319e pin arrangement (tfp-100b: top view)
section 1 overview rev.7.00 feb. 14, 2007 page 12 of 1108 rej09b0089-0700 p10 /ti oca0 / a20 p11 /ti ocb0 / a21 p12 /ti occ0 /t c lk a / a22 p13 /ti ocd0 /t c lk b / a23 p1 4/ti oca1 p15 /ti ocb1 /t c lk c p16 /ti oca2 p17 /ti ocb2 /t c lk d v ss p30 /t xd0 p31 /t xd1 /t do * p32 / rxd0 p33 / rxd1 /t d i * p3 4/ sc k 0 / i rq 4 p35 / sc k 1 / i rq 5 /t c k * p e 0 / d0 p e 1 / d1 p e 2 / d2 p e 3 / d3 v ss p e4/ d 4 p e 5 / d5 p e 6 / d6 p e 7 / d7 pd0 / d8 pd1 / d9 pd2 / d10 pd3 / d11 pd 4/ d12 pd5 / d13 1 2 3 4 5 6 7 8 9 10 11 12 13 1 4 15 16 17 18 19 20 21 22 23 2 4 25 26 27 28 29 30 v ref av cc p f 0 / br e q / i rq0 / cs 4 p f 1 / b a ck / i rq 1 / cs 5 p f 2 / w ait / i rq2 / br e qo p f 3 / l wr /i rq3 p f4/ h wr p f 5 / rd p f 6 / a s p f 7 / v ss e x t a l x t a l v cc s t by n m i r e s md2 e m le * p23 /ti ocd3 /t mc i 0 md1 md0 p22 /ti occ3 /t mr i 0 p21 /ti ocb3 / t rs t * p20 /ti oca3 /t ms * pa3 / a19 pa2 / a18 pa1 / a17 pa0 / a16 v ss 80 79 78 77 76 75 7 4 73 72 71 70 69 68 67 66 65 6 4 63 62 61 60 59 58 57 56 55 5 4 53 52 51 pb7 / a15 pb6 / a1 4 pb5 / a13 pb 4/ a12 pb3 / a11 pb2 / a10 pb1 / a9 pb0 / a8 v cc pc7 / a7 pc6 / a6 pc5 / a5 pc 4/ a 4 pc3 / a3 pc2 / a2 pc1 / a1 pc0 / a0 v ss pd7 / d15 pd6 / d1 4 p 4 0 / a n 0 p 4 1 / a n 1 p 4 2 / a n 2 p 4 3 / a n 3 p 44/ a n4 p 4 5 / a n 5 p 4 6 / a n 6 / da0 p 4 7 / a n 7 / da1 av ss v ss p2 4/ti oca 4/t mr i 1 p25 /ti ocb 4/t mc i 1 p26 /ti oca5 /t mo0 p27 /ti ocb5 /t mo1 pg0 / a d t rg / i rq6 pg1 / cs3 / i rq7 / cs6 pg2 / cs2 pg3 / cs 1 / cs7 pg 4/ cs0 v cc 50 4 9 4 8 4 7 4 6 4 5 44 4 3 4 2 4 1 4 0 39 38 37 36 35 3 4 33 32 31 81 82 83 8 4 85 86 87 88 89 90 91 92 93 9 4 95 96 97 98 99 100 n ote : * i f an e 10a emu l ator i s used, the t do, t d i , t d k , t ms, and t rs t p i ns are used exc l us i ve l y for the h- ud i and the funct i ons and funct i on modu l es assoc i ated wi th these p i ns are not ava il ab l e . ( t he sc i channe l 1 i s unava il ab l e w hen the on - ch i p debug funct i on i s i n use . a l so, s i nce the wd t cont i nues to operate dur i ng break status, a reset i s generated w hen an overf l o w occurs i f a sett i ng i s made to reset the ch i p i nterna ll y . ) refer to the h 8s, h 8sx f am il y e 10a - usb e mu l ator user ' s manua l for e 10a emu l ator connect i on examp l es . refer to the h 8s / 2319 f- z t a t sect i on for h d6 4f 2319 e. e10a compatible version figure 1.5 hd64f2319e pin arrangement (fp-100a: top view)
section 1 overview rev.7.00 feb. 14, 2007 page 13 of 1108 rej09b0089-0700 1 nc p11 pg3 pg2 p26 vss p45 p41 vref pf0 avcc p10 vcc pg4 nc p27 avss p44 p42 pf2 pf1 p16 nc p14 pg1 pg0 p47 p43 nc pf3 pf4 vss p17 nc p25 p24 p46 pf5 p40 nc pf7 p33 p32 p31 nc (top view) notes: 1. nc on h8s/2316s and h8s/2317s. 2. wd t ov f on h8s/2316s and h8s/2317s. stby vss pf6 vcc pe2 pe3 p35 nmi extal xtal res pe5 vss pe0 vcl (nc) * 1 nc ( wd t ov f ) * 2 md2 p23 nc pd6 pe6 pc2 pc6 pc7 nc md0 md1 p21 pd0 pe7 vss pc3 pb1 pb2 p20 pb6 p22 pa3 pd1 vss pc0 pc4 pb0 pb4 pb5 pb7 vss pa1 pd3 pd5 pd7 pc1 pc5 vcc pb3 nc pa0 pa2 p12 p13 p15 p30 p34 pe1 pe4 nc pd2 pd4 a b c d e f g h j k l 234567891011 figure 1.6 hd64f2319clp, hd6432317slp, hd6432316slp pin arrangement (tlp-113v: top view)
section 1 overview rev.7.00 feb. 14, 2007 page 14 of 1108 rej09b0089-0700 1.3.2 pin functions in each operating mode table 1.2 shows the pin functions in each of the operating modes. table 1.2 pin functions in each operating mode pin no. pin name tfp-100b, tfp-100g fp-100a tlp-113v mode 4 mode 5 mode 6 * 1 mode 7 * 1 flash memory programmer mode 1 3 b1 p12/tiocc0/ tclka/a22 p12/tiocc0/ tclka/a22 p12/tiocc0/ tclka/a22 p12/tiocc0/ tclka nc 2 4 c1 p13/tiocd0/ tclkb/a23 p13/tiocd0/ tclkb/a23 p13/tiocd0/ tclkb/a23 p13/tiocd0/ tclkb nc 3 5 c4 p14/tioca1 p14/tioca1 p14/tioca1 p14/tioca1 nc 4 6 d1 p15/tiocb1/ tclkc p15/tiocb1/ tclkc p15/tiocb1/ tclkc p15/tiocb1/ tclkc nc 5 7 c2 p16/tioca2 p16/tioca2 p16/tioca2 p16/tioca2 nc 6 8 d3 p17/tiocb2/ tclkd p17/tiocb2/ tclkd p17/tiocb2/ tclkd p17/tiocb2/ tclkd nc 7 9 d2 v ss v ss v ss v ss v ss 8 10 e1 p30/txd0 p30/txd0 p30/txd0 p30/txd0 nc 9 11 e4 p31/txd1 p31/txd1 p31/txd1 p31/txd1 nc 10 12 e3 p32/rxd0 p32/rxd0 p32/rxd0 p32/rxd0 nc 11 13 e2 p33/rxd1 p33/rxd1 p33/rxd1 p33/rxd1 nc 12 14 f1 p34/sck0/ irq4 p34/sck0/ irq4 p34/sck0/ irq4 p34/sck0/ irq4 nc 13 15 f4 p35/sck1/ irq5 p35/sck1/ irq5 p35/sck1/ irq5 p35/sck1/ irq5 nc 14 16 g4 pe0/d0 pe0/d0 pe0/d0 pe0 nc 15 17 g1 pe1/d1 pe1/d1 pe1/d1 pe1 nc 16 18 f2 pe2/d2 pe2/d2 pe2/d2 pe2 nc 17 19 f3 pe3/d3 pe3/d3 pe3/d3 pe3 nc 18 20 g3 v ss v ss v ss v ss v ss 19 21 h1 pe4/d4 pe4/d4 pe4/d4 pe4 nc 20 22 g2 pe5/d5 pe5/d5 pe5/d5 pe5 nc 21 23 h4 pe6/d6 pe6/d6 pe6/d6 pe6 nc 22 24 j3 pe7/d7 pe7/d7 pe7/d7 pe7 nc 23 25 j2 d8 d8 d8 pd0 i/o0 24 26 k2 d9 d9 d9 pd1 i/o1 25 27 k1 d10 d10 d10 pd2 i/o2 26 28 l2 d11 d11 d11 pd3 i/o3
section 1 overview rev.7.00 feb. 14, 2007 page 15 of 1108 rej09b0089-0700 pin no. pin name tfp-100b, tfp-100g fp-100a tlp-113v mode 4 mode 5 mode 6 * 1 mode 7 * 1 flash memory programmer mode 27 29 l1 d12 d12 d12 pd4 i/o4 28 30 l3 d13 d13 d13 pd5 i/o5 29 31 h3 d14 d14 d14 pd6 i/o6 30 32 l4 d15 d15 d15 pd7 i/o7 31 33 j4 v ss v ss v ss v ss v ss 32 34 k4 a0 a0 pc0/a0 pc0 a0 33 35 l5 a1 a1 pc1/a1 pc1 a1 34 36 h5 a2 a2 pc2/a2 pc2 a2 35 37 j5 a3 a3 pc3/a3 pc3 a3 36 38 k5 a4 a4 pc4/a4 pc4 a4 37 39 l6 a5 a5 pc5/a5 pc5 a5 38 40 h6 a6 a6 pc6/a6 pc6 a6 39 41 h7 a7 a7 pc7/a7 pc7 a7 40 42 l7 v cc v cc v cc v cc v cc 41 43 k6 a8 a8 pb0/a8 pb0 a8 42 44 j6 a9 a9 pb1/a9 pb1 a9 43 45 j7 a10 a10 pb2/a10 pb2 a10 44 46 l8 a11 a11 pb3/a11 pb3 a11 45 47 k7 a12 a12 pb4/a12 pb4 a12 46 48 k8 a13 a13 pb5/a13 pb5 a13 47 49 j9 a14 a14 pb6/a14 pb6 a14 48 50 k9 a15 a15 pb7/a15 pb7 a15 49 51 k10 v ss v ss v ss v ss v ss 50 52 l10 a16 a16 pa0/a16 pa0 a16 51 53 k11 a17 a17 pa1/a17 pa1 a17 52 54 l11 a18 a18 pa2/a18 pa2 a18 53 55 j11 a19 a19 pa3/a19 pa3 nc 54 56 j8 p20/tioca3 p20/tioca3 p20/tioca3 p20/tioca3 oe 55 57 h11 p21/tiocb3 p21/tiocb3 p21/tiocb3 p21/tiocb3 ce 56 58 j10 p22/tiocc3/ tmri0 p22/tiocc3/ tmri0 p22/tiocc3/ tmri0 p22/tiocc3/ tmri0 we 57 59 h9 md0 md0 md0 md0 v ss 58 60 h10 md1 md1 md1 md1 v ss 59 61 g11 p23/tiocd3/ tmci0 p23/tiocd3/ tmci0 p23/tiocd3/ tmci0 p23/tiocd3/ tmci0 v cc
section 1 overview rev.7.00 feb. 14, 2007 page 16 of 1108 rej09b0089-0700 pin no. pin name tfp-100b, tfp-100g fp-100a tlp-113v mode 4 mode 5 mode 6 * 1 mode 7 * 1 flash memory programmer mode 60 62 ? wdtovf (fwe, emle, v cl ) * 2 wdtovf (fwe, emle, v cl ) * 2 wdtovf (fwe, emle, v cl ) * 2 wdtovf (fwe, emle, v cl ) * 2 fwe, emle, v cl * 2 61 63 g10 md2 md2 md2 md2 v ss 62 64 f11 res res res res res 63 65 f8 nmi nmi nmi nmi v cc 64 66 e8 stby stby stby stby v cc 65 67 e11 v cc v cc v cc v cc v cc 66 68 f10 xtal xtal xtal xtal xtal 67 69 f9 extal extal extal extal extal 68 70 e9 v ss v ss v ss v ss v ss 69 71 d11 pf7/ pf7/ pf7/ pf7/ nc 70 72 e10 pf6/ as pf6/ as pf6/ as pf6 nc 71 73 d8 rd rd rd pf5 nc 72 74 c11 hwr hwr hwr pf4 nc 73 75 c10 pf3/ lwr / irq3 pf3/ lwr / irq3 pf3/ lwr / irq3 pf3/ irq3 nc 74 76 b10 pf2/ wait / irq2 / dreqo pf2/ wait / irq2 / dreqo pf2/ wait / irq2 / dreqo pf2/ irq2 v cc 75 77 b11 pf1/ back / irq1 / cs5 pf1/ back / irq1 / cs5 pf1/ back / irq1 / cs5 pf1/ irq1 v ss 76 78 a10 pf0/ breq / irq0 / cs4 pf0/ breq / irq0 / cs4 pf0/ breq / irq0 / cs4 pf0/ irq0 v ss 77 79 a11 av cc av cc av cc av cc v cc 78 80 a9 v ref v ref v ref v ref v cc 79 81 d9 p40/an0 p40/an0 p40/an0 p40/an0 nc 80 82 a8 p41/an1 p41/an1 p41/an1 p41/an1 nc 81 83 b9 p42/an2 p42/an2 p42/an2 p42/an2 nc 82 84 c8 p43/an3 p43/an3 p43/an3 p43/an3 nc 83 85 b8 p44/an4 p44/an4 p44/an4 p44/an4 nc 84 86 a7 p45/an5 p45/an5 p45/an5 p45/an5 nc 85 87 d7 p46/an6/da0 p46/an6/da0 p46/an6/da0 p46/an6/da0 nc 86 88 c7 p47/an7/da1 p47/an7/da1 p47/an7/da1 p47/an7/da1 nc 87 89 b7 av ss av ss av ss av ss v ss 88 90 a6 v ss v ss v ss v ss v ss 89 91 d6 p24/tioca4/ tmri1 p24/tioca4/ tmri1 p24/tioca4/ tmri1 p24/tioca4/ tmri1 nc
section 1 overview rev.7.00 feb. 14, 2007 page 17 of 1108 rej09b0089-0700 pin no. pin name tfp-100b, tfp-100g fp-100a tlp-113v mode 4 mode 5 mode 6 * 1 mode 7 * 1 flash memory programmer mode 90 92 d5 p25/tiocb4/ tmci1 p25/tiocb4/ tmci1 p25/tiocb4/ tmci1 p25/tiocb4/ tmci1 v ss 91 93 a5 p26/tioca5/ tmo0 p26/tioca5/ tmo0 p26/tioca5/ tmo0 p26/tioca5/ tmo0 nc 92 94 b6 p27/tiocb5/ tmo1 p27/tiocb5/ tmo1 p27/tiocb5/ tmo1 p27/tiocb5/ tmo1 nc 93 95 c6 pg0/ irq6 / adtrg pg0/ irq6 / adtrg pg0/ irq6 / adtrg pg0/ irq6 / adtrg nc 94 96 c5 pg1/ cs3 / irq7 / cs6 pg1/ cs3 / irq7 / cs6 pg1/ cs3 / irq7 / cs6 pg1/ irq7 nc 95 97 a4 pg2/ cs2 pg2/ cs2 pg2/ cs2 pg2 nc 96 98 a3 pg3/ cs1 / cs7 pg3/ cs1 / cs7 pg3/ cs1 / cs7 pg3 nc 97 99 b4 pg4/ cs0 pg4/ cs0 pg4/ cs0 pg4 nc 98 100 b3 v cc v cc v cc v cc v cc 99 1 b2 p10/tioca0/a20 p10/tioca0/a20 p10/tioca0/a20 p10/tioca0 nc 100 2 a2 p11/tiocb0/a21 p11/tiocb0/a21 p11/tiocb0/a21 p11/tiocb0 nc ? ? a1, b5, c3, c9, d4, d10, e5, h2, h8, j1, l9 nc nc nc nc nc ? ? k3 vss vss vss vss vss ? ? g8 v cl (nc) * 3 v cl (nc) * 3 v cl (nc) * 3 v cl (nc) * 3 v cl (nc) * 3 ? ? g9 nc ( wdtovf ) * 3 nc ( wdtovf ) * 3 nc ( wdtovf ) * 3 nc ( wdtovf ) * 3 nc notes: 1. only modes 4 and 5 are available in the romless version. 2. the fwe pin function is only available in the h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat. the emle pin function is only available in the h8s/2319 f-ztat. the v cl pin function is only available in the h8s/2319c f-ztat. it cannot be used as a wdtovf pin in the f-ztat versions. 3. items in parentheses ( ) indicate pin names on the h8s/2316s and h8s/2317s.
section 1 overview rev.7.00 feb. 14, 2007 page 18 of 1108 rej09b0089-0700 1.3.3 pin functions table 1.3 pin functions pin no. type symbol tfp-100b, tfp-100g fp-100a tlp-113v i/o name and function power supply v cc 40, 65, 98 42, 67, 100 b3, e11, l7 input power supply: for connection to the power supply. all v cc pins should be connected to the system power supply. v ss 7, 18, 31, 49, 68, 88 9, 20, 33, 51, 70, 90 a6, d2, e9, g3, j4, k3, k10 input ground: for connection to ground (0 v). all v ss pins should be connected to the system power supply (0 v). internal voltage step-down pin v cl * 1 60 62 g8 output an external capacitor should be connected between this pin and gnd (0 v). do not connect it to v cc . clock xtal 66 68 f10 input connects to a crystal oscillator. see section 18, clock pulse generator, for typical connection diagrams for a crystal oscillator and external clock input. extal 67 69 f9 input connects to a crystal oscillator. the extal pin can also input an external clock. see section 18, clock pulse generator, for typical connection diagrams for a crystal oscillator and external clock input. 69 71 d11 output system clock: supplies the system clock to an external device.
section 1 overview rev.7.00 feb. 14, 2007 page 19 of 1108 rej09b0089-0700 pin no. type symbol tfp-100b, tfp-100g fp-100a tlp-113v i/o name and function operating mode control md2 to md0 61, 58, 57 63, 60, 59 g10, h10, h9 input mode pins: these pins set the operating mode. the relation between the settings of pins md2 to md0 and the operating mode is shown below. these pins should not be changed while the h8s/2319 group is operating. ? h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat fwe md2 md1 md0 operating mode 0 0 0 1 ? 1 0 ? 1 ? 1 0 0 mode 4 1 mode 5 1 0 mode 6 1 mode 7 1 0 0 0 ? 1 ? 1 0 mode 10 1 mode 11 1 0 0 ? 1 ? 1 0 mode 14 1 mode 15
section 1 overview rev.7.00 feb. 14, 2007 page 20 of 1108 rej09b0089-0700 pin no. type symbol tfp-100b, tfp-100g fp-100a tlp-113v i/o name and function operating mode control md2 to md0 61, 58, 57 63, 60, 59 g10, h10, h9 input ? mask rom and romless versions, h8s/2319 f-ztat, and h8s/2319c f-ztat md2 md1 md0 operating mode 0 0 1 mode 1 * 1 1 0 mode 2 * 2 1 mode 2 * 2 1 0 0 mode 4 * 3 1 mode 5 * 3 1 0 mode 6 1 mode 7 system control res 62 64 f11 input reset input: when this pin is driven low, the chip is reset. stby 64 66 e8 input standby: when this pin is driven low, a transition is made to hardware standby mode. breq 76 78 a10 input bus request: used by an external bus master to issue a bus request to the h8s/2319 group. breqo 74 76 b10 output bus request output: external bus request signal used when an internal bus master accesses external space in the external-bus-released state. back 75 77 b11 output bus request acknowledge: indicates that the bus has been released to an external bus master. fwe * 4 60 62 ? input flash write enable: enables or disables writing to flash memory. emle * 5 60 62 ? input emulator enable: for connection to ground (0 v).
section 1 overview rev.7.00 feb. 14, 2007 page 21 of 1108 rej09b0089-0700 pin no. type symbol tfp-100b, tfp-100g fp-100a tlp-113v i/o name and function interrupts nmi 63 65 f8 input nonmaskable interrupt: requests a nonmaskable interrupt. when this pin is not used, it should be fixed high. irq7 to irq0 94, 93, 13, 12, 73 to 76 96, 95, 15, 14, 75 to 78 c5, c6, f4, f1, c10, b10, b11, a10 input interrupt request 7 to 0: these pins request a maskable interrupt. address bus a23 to a0 2, 1, 100, 99, 53 to 50, 48 to 41, 39 to 32 4 to 1, 55 to 52, 50 to 43, 41 to 34 c1, b1, a2, b2, j11, l11, k11, l10, k9, j9, k8, k7, l8, j7, j6, k6, h7, h6, l6, k5, j5, h5, l5, k4 output address bus: these pins output an address. data bus d15 to d0 30 to 19, 17 to 14 32 to 21, 19 to 16 l4, h3, l3, l1, l2, k1, k2, j2, j3, h4, g2, h1, f3, f2, g1, g4 i/o data bus: these pins constitute a bidirectional data bus. bus control cs7 to cs0 94 to 97 75, 76 96 to 99 77, 78 a3, c5, b11, a10, a4, b4 output chip select: signals for selecting areas 7 to 0. as 70 72 e10 output address strobe: when this pin is low, it indicates that address output on the address bus is enabled. rd 71 73 d8 output read: when this pin is low, it indicates that the external address space can be read. hwr 72 74 c11 output high write: a strobe signal that writes to external space and indicates that the upper half (d15 to d8) of the data bus is enabled. lwr 73 75 c10 output low write: a strobe signal that writes to external space and indicates that the lower half (d7 to d0) of the data bus is enabled.
section 1 overview rev.7.00 feb. 14, 2007 page 22 of 1108 rej09b0089-0700 pin no. type symbol tfp-100b, tfp-100g fp-100a tlp-113v i/o name and function bus control wait 74 76 b10 input wait: requests insertion of a wait state in the bus cycle when accessing external 3-state access space. tclkd to tclka 6, 4, 2, 1 8, 6, 4, 3 d3, d1, c1, b1 input clock input d to a: these pins input an external clock. 16-bit timer- pulse unit (tpu) tioca0, tiocb0, tiocc0, tiocd0 99, 100, 1, 2 1 to 4 b2, a2, b1, c1 i/o input capture/ output compare match a0 to d0: the tgr0a to tgr0d input capture input or output compare output, or pwm output pins. tioca1, tiocb1 3, 4 5, 6 c4, d1 i/o input capture/ output compare match a1 and b1: the tgr1a and tgr1b input capture input or output compare output, or pwm output pins. tioca2, tiocb2 5, 6 7, 8 c2, d3 i/o input capture/ output compare match j8, h11, j10, g11a2 and b2: the tgr2a and tgr2b input capture input or output compare output, or pwm output pins. tioca3, tiocb3, tiocc3, tiocd3 54 to 56, 59 56 to 58, 61 j8, h11, j10, g11 i/o input capture/ output compare match a3 to d3: the tgr3a to tgr3d input capture input or output compare output, or pwm output pins. tioca4, tiocb4 89, 90 91, 92 d6, d5 i/o input capture/ output compare match a4 and b4: the tgr4a and tgr4b input capture input or output compare output, or pwm output pins. tioca5, tiocb5 91, 92 93, 94 a5, b6 i/o input capture/ output compare match a5 and b5: the tgr5a and tgr5b input capture input or output compare output, or pwm output pins. 8-bit timer tmo0, tmo1 91, 92 93, 94 a5, b6 output compare match output: the compare match output pins. tmci0, tmci1 59, 90 61, 92 g11, d5 input counter external clock input: input pins for the external clock input to the counter. tmri0, tmri1 56, 89 58, 91 j10, d6 input counter external reset input: the counter reset input pins.
section 1 overview rev.7.00 feb. 14, 2007 page 23 of 1108 rej09b0089-0700 pin no. type symbol tfp-100b, tfp-100g fp-100a tlp-113v i/o name and function watchdog timer (wdt) wdtovf * 6 60 62 g9 output watchdog timer overflows: the counter overflows signal output pin in watchdog timer mode. txd1, txd0 9, 8 11, 10 e4, e1 output transmit data (channel 0, 1): data output pins. rxd1, rxd0 11, 10 13, 12 e2, e3 input receive data (channel 0, 1): data input pins. serial com- munication interface (sci) smart card interface sck1 sck0 13, 12 15, 14 f1, f4 i/o serial clock (channel 0, 1): clock i/o pins. a/d converter an7 to an0 86 to 79 88 to 81 d7, c7, a7, b8, c8, b9, a8, d9 input analog 7 to 0: analog input pins. adtrg 93 95 c6 input a/d conversion external trigger input: pin for input of an external trigger to start a/d conversion. d/a converter da1, da0 86, 85 88, 87 d7, c7 output analog output: d/a converter analog output pins. a/d converter and d/a converter av cc 77 79 a11 input this is the power supply pin for the a/d converter and d/a converter. when the a/d converter and d/a converter are not used, this pin should be connected to the system power supply (v cc ). av ss 87 89 b7 input this is the ground pin for the a/d converter and d/a converter. this pin should be connected to the system power supply (0 v). v ref 78 80 a9 input this is the reference voltage input pin for the a/d converter and d/a converter. when the a/d converter and d/a converter are not used, this pin should be connected to the system power supply (v cc ).
section 1 overview rev.7.00 feb. 14, 2007 page 24 of 1108 rej09b0089-0700 pin no. type symbol tfp-100b, tfp-100g fp-100a tlp-113v i/o name and function i/o ports p17 to p10 6 to 1, 100, 99 8 to 1 d3, c2, d1, c4, c1, b1, a2, b2 i/o port 1: an 8-bit i/o port. input or output can be designated for each bit by means of the port 1 data direction register (p1ddr). p27 to p20 92 to 89, 59, 56 to 54 94 to 91, 61, 58 to 56 b6, a5, d5, d6, g11, j10, h11, j8 i/o port 2: an 8-bit i/o port. input or output can be designated for each bit by means of the port 2 data direction register (p2ddr). p35 to p30 13 to 8 15 to 10 f4, f1, e2, e3, e4, e1 i/o port 3: a 6-bit i/o port. input or output can be designated for each bit by means of the port 3 data direction register (p3ddr). p47 to p40 86 to 79 88 to 81 d7, c7, a7, b8, c8, b9, a8, d9 input port 4: an 8-bit input port. pa3 to pa0 53 to 50 55 to 52 j11, l11, k11, l10 i/o port a * 7 : a 4-bit i/o port. input or output can be designated for each bit by means of the port a data direction register (paddr). pb7 to pb0 48 to 41 50 to 43 k9, j9, k8, k7, l8, j7, j6, k6 i/o port b * 7 : an 8-bit i/o port. input or output can be designated for each bit by means of the port b data direction register (pbddr). pc7 to pc0 39 to 32 41 to 34 h7, h6, l6, k5, j5, h5, l5, k4 i/o port c * 7 : an 8-bit i/o port. input or output can be designated for each bit by means of the port c data direction register (pcddr). pd7 to pd0 30 to 23 32 to 25 l4, h3, l3, l1, l2, k1, k2, j2 i/o port d * 7 : an 8-bit i/o port. input or output can be designated for each bit by means of the port d data direction register (pdddr). pe7 to pe0 22 to 19, 17 to 14 24 to 21, 19 to 16 j3, h4, g2, h1, f3, f2, g1, g4 i/o port e: an 8-bit i/o port. input or output can be designated for each bit by means of the port e data direction register (peddr).
section 1 overview rev.7.00 feb. 14, 2007 page 25 of 1108 rej09b0089-0700 pin no. type symbol tfp-100b, tfp-100g fp-100a tlp-113v i/o name and function i/o ports pf7 to pf0 69 to 76 71 to 78 d11, e10, d8, c11, c10, b10, b11, a10 i/o port f: an 8-bit i/o port. input or output can be designated for each bit by means of the port f data direction register (pfddr). pg4 to pg0 97 to 93 99 to 95 b4, a3, a4, c5, c6 i/o port g: a 5-bit i/o port. input or output can be designated for each bit by means of the port g data direction register (pgddr). notes: 1. applies to the h8s/2319c f-ztat only. 2. applies to the h8s/2319 f-ztat and h8s/2319c f-ztat only. 3. only modes 4 and 5 are available in the romless versions. 4. applies to the h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat only. 5. applies to the h8s/2319 f-ztat only. 6. applies to mask rom and romless versions only. cannot be used as an i/o port in the romless versions.
section 1 overview rev.7.00 feb. 14, 2007 page 26 of 1108 rej09b0089-0700
section 2 cpu rev.7.00 feb. 14, 2007 page 27 of 1108 rej09b0089-0700 section 2 cpu 2.1 overview the h8s/2000 cpu is a high-speed central processing unit with an internal 32-bit architecture that is upward-compatible with the h8/300 and h8/300h cpus. the h8s/2000 cpu has sixteen 16-bit general registers, can address a 16-mbyte (4-gbyte architecturally) linear address space, and is ideal for realtime control. 2.1.1 features the h8s/2000 cpu has the following features. ? upward-compatible with h8/300 and h8/300h cpus ? can execute h8/300 and h8/300h object programs ? general-register architecture ? sixteen 16-bit general registers (also usable as sixteen 8-bit registers or eight 32-bit registers) ? sixty-five basic instructions ? 8/16/32-bit arithmetic and logic instructions ? multiply and divide instructions ? powerful bit-manipulation instructions ? eight addressing modes ? register direct [rn] ? register indirect [@ern] ? register indirect with displacement [@(d:16,ern) or @(d:32,ern)] ? register indirect with post-increment or pre-decrement [@ern+ or @?ern] ? absolute address [@aa:8, @aa:16, @aa:24, or @aa:32] ? immediate [#xx:8, #xx:16, or #xx:32] ? program-counter relative [@(d:8,pc) or @(d:16,pc)] ? memory indirect [@@aa:8] ? 16-mbyte address space ? program: 16 mbytes ? data: 16 mbytes (4 gbytes architecturally)
section 2 cpu rev.7.00 feb. 14, 2007 page 28 of 1108 rej09b0089-0700 ? high-speed operation ? all frequently-used instructions execute in one or two states ? maximum clock rate : 25 mhz ? 8/16/32-bit register-register add/subtract : 40 ns ? 8 8-bit register-register multiply : 480 ns ? 16 8-bit register-register divide : 480 ns ? 16 16-bit register-register multiply : 800 ns ? 32 16-bit register-register divide : 800 ns ? cpu operating mode ? advanced mode ? power-down state ? transition to power-down state by sleep instruction ? cpu clock speed selection 2.1.2 differences between h8 s/2600 cpu and h8s/2000 cpu the differences between the h8s/2600 cpu and the h8s/2000 cpu are as shown below. ? register configuration the mac register is supported only by the h8s/2600 cpu. ? basic instructions the four instructions mac, clrmac, ldmac, and stmac are supported only by the h8s/2600 cpu. ? number of execution states the number of exection states of the mulxu and mulxs instructions. internal operation instruction mnemonic h8s/2600 h8s/2000 mulxu mulxu.b rs, rd 3 12 mulxu.w rs, erd 4 20 mulxs mulxs.b rs, rd 4 13 mulxs.w rs, erd 5 21 there are also differences in the address space, ccr and exr functions, power-down state, etc., depending on the product.
section 2 cpu rev.7.00 feb. 14, 2007 page 29 of 1108 rej09b0089-0700 2.1.3 differences from h8/300 cpu in comparison to the h8/300 cpu, the h8s/2000 cpu has the following enhancements. ? more general registers and control registers ? eight 16-bit expanded registers, and one 8-bit control register, have been added. ? expanded address space ? advanced mode supports a maximum 16-mbyte address space. ? enhanced addressing ? the addressing modes have been enhanced to make effective use of the 16-mbyte address space. ? enhanced instructions ? addressing modes of bit-manipulation instructions have been enhanced. ? signed multiply and divide instructions have been added. ? two-bit shift instructions have been added. ? instructions for saving and restoring multiple registers have been added. ? a test and set instruction has been added. ? higher speed ? basic instructions execute twice as fast. 2.1.4 differences from h8/300h cpu in comparison to the h8/300h cpu, the h8s/2000 cpu has the following enhancements. ? additional control register ? one 8-bit control register has been added. ? enhanced instructions ? addressing modes of bit-manipulation instructions have been enhanced. ? two-bit shift instructions have been added. ? instructions for saving and restoring multiple registers have been added. ? a test and set instruction has been added. ? higher speed ? basic instructions execute twice as fast.
section 2 cpu rev.7.00 feb. 14, 2007 page 30 of 1108 rej09b0089-0700 2.2 cpu operating modes the h8s/2319 group cpu has advanced operating mode. advanced mode supports a maximum 16-mbyte total address space (architecturally a maximum 16-mbyte program area and a maximum of 4 gbytes for program and data areas combined). the mode is selected by the mode pins of the microcontroller. advanced mode address space: linear access is provided to a 16-mbyte maximum address space (architecturally a maximum 16-mbyte program area and a maximum 4-gbyte data area, with a maximum of 4 gbytes for program and data areas combined). extended registers (en): the extended registers (e0 to e7) can be used as 16-bit registers, or as the upper 16-bit segments of 32-bit registers or address registers. instruction set: all instructions and addressing modes can be used.
section 2 cpu rev.7.00 feb. 14, 2007 page 31 of 1108 rej09b0089-0700 exception vector table and memo ry indirect branch addresses: in advanced mode the top area starting at h'00000000 is allocated to the exception vector table in units of 32 bits. in each 32 bits, the upper 8 bits are ignored and a branch address is stored in the lower 24 bits (figure 2.1). for details of the exception vector table, see section 4, exception handling. h'00000000 h'00000003 h'00000004 h'0000000b h'0000000c exception vector table reserved power-on reset exception vector (reserved for system use) reserved exception vector 1 reserved h'00000010 h'00000008 h'00000007 figure 2.1 excep tion vector tabl e (advanced mode) the memory indirect addressing mode (@@aa:8) employed in the jmp and jsr instructions uses an 8-bit absolute address included in the instruction code to specify a memory operand that contains a branch address. in advanced mode the operand is a 32-bit longword operand, providing a 32-bit branch address. the upper 8 bits of these 32 bits are a reserved area that is regarded as h'00. branch addresses can be stored in the area from h'00000000 to h'000000ff. note that the first part of this range is also the exception vector table.
section 2 cpu rev.7.00 feb. 14, 2007 page 32 of 1108 rej09b0089-0700 stack structure: in advanced mode, when the program counter (pc) is pushed onto the stack in a subroutine call, and the pc, condition-code register (ccr), and extended control register (exr) are pushed onto the stack in exception handling, they are stored as shown in figure 2.2. when exr is invalid, it is not pushed onto the stack. for details, see section 4, exception handling. (a) subroutine branch (b) exception handling pc (24 bits) exr * 1 reserved * 1 * 3 ccr pc (24 bits) sp sp notes: 1. 2. 3. when exr is not used it is not stored on the stack. sp when exr is not used. ignored when returning. (sp ) * 2 reserved figure 2.2 stack stru cture in advanced mode
section 2 cpu rev.7.00 feb. 14, 2007 page 33 of 1108 rej09b0089-0700 2.3 address space figure 2.3 shows a memory map of the h8s/2000 cpu. the h8s/2000 cpu provides linear access to a maximum 16-mbyte (4-gbyte architecturally) address space in advanced mode. a dvanced m ode h' 00000000 h'ffffffff h' 00 ffffff d ata area program area cannot be used by the h 8s / 231 9 g roup figure 2.3 memory map
section 2 cpu rev.7.00 feb. 14, 2007 page 34 of 1108 rej09b0089-0700 2.4 register configuration 2.4.1 overview the cpu has the internal registers shown in figure 2.4. there are two types of registers: general registers and control registers. t ???? i 2 i 1 i 0 e xr 7 654 3210 pc 23 0 1 5 07 07 0 e 0 e 1 e 2 e 3 e4 e5 e6 e 7 r0 h r1 h r2 h r3 h r 4h r 5h r 6h r7 h r0 l r1 l r2 l r3 l r 4l r 5l r 6l r7 l ge n e ra l re g is t e r s ( r n) and ex t e nd e d re g is t e r s ( e n) c ontro l re g is t e r s ( cr ) l egend : stack po i nter program counter e xtended contro l reg i ster t race b i t i nterrupt mask b i ts cond i t i on - code reg i ster i nterrupt mask b i t u ser b i t or i nterrupt mask b i t * sp : pc : e xr : t: i 2 to i 0 : ccr : i: ui: n ote : * i n the h 8s / 231 9 g roup , th i s b i t cannot be used as an i nterrupt mask . e r0 e r1 e r2 e r3 e r 4 e r 5 e r 6 e r7 (sp) i ui hunzv c ccr 7 654 3210 h a l f - carry f l ag u ser b i t n egat i ve f l ag z ero f l ag o verf l ow f l ag carry f l ag h: u: n: z: v: c : figure 2.4 cpu registers
section 2 cpu rev.7.00 feb. 14, 2007 page 35 of 1108 rej09b0089-0700 2.4.2 general registers the cpu has eight 32-bit general registers. these general registers are all functionally alike and can be used as both address registers and data registers. when a general register is used as a data register, it can be accessed as a 32-bit, 16-bit, or 8- bit register. when the general registers are used as 32-bit registers or address registers, they are designated by the letters er (er0 to er7). the er registers divide into 16-bit general registers designated by the letters e (e0 to e7) and r (r0 to r7). these registers are functionally equivalent, providing a maximum sixteen 16-bit registers. the e registers (e0 to e7) are also referred to as extended registers. the r registers divide into 8-bit general registers designated by the letters rh (r0h to r7h) and rl (r0l to r7l). these registers are functionally equivalent, providing a maximum sixteen 8-bit registers. figure 2.5 illustrates the usage of the general registers. the usage of each register can be selected independently. ? a ddress registers ? 32-bit registers ? 1 6 -bit registers ? 8-bit registers er registers (er0 to er7) e registers (extended registers) (e0 to e7) r registers (r0 to r7) rh registers (r0h to r7h) rl registers (r0l to r7l) figure 2.5 usage of general registers general register er7 has the function of stack pointer (sp) in addition to its general-register function, and is used implicitly in exception handling and subroutine calls. figure 2.6 shows the stack.
section 2 cpu rev.7.00 feb. 14, 2007 page 36 of 1108 rej09b0089-0700 free area stack area sp (er7) figure 2.6 stack 2.4.3 control registers the control registers are the 24-bit program counte r (pc), 8-bit extended control register (exr), and 8-bit condition-code register (ccr). (1) program counter (pc) this 24-bit counter indicates the address of the next instruction the cpu will execute. the length of all cpu instructions is 2 bytes (one word), so the least significant pc bit is ignored (when an instruction is fetched, the least significant pc bit is regarded as 0). (2) extended control register (exr) this 8-bit register contains the trace bit (t) and three interrupt mask bits (i2 to i0). bit 7?trace bit (t): selects trace mode. when this bit is cl eared to 0, instructions are executed in sequence. when this bit is set to 1, a trace exception is generated each time an instruction is executed. bits 6 to 3?reserved: these bits are reserved. they are always read as 1. bits 2 to 0?interrupt mask bits (i2 to i0): these bits designate the interrupt mask level (0 to 7). for details, refer to section 5, interrupt controller. operations can be performed on the exr bits by the ldc, stc, andc, orc, and xorc instructions. all interrupts, including nmi, are disabled for three states after one of these instructions is executed, except for stc.
section 2 cpu rev.7.00 feb. 14, 2007 page 37 of 1108 rej09b0089-0700 (3) condition-code register (ccr) this 8-bit register contains internal cpu status information, including an interrupt mask bit (i) and half-carry (h), negative (n), zero (z), overflow (v), and carry (c) flags. bit 7?interrupt mask bit (i): masks interrupts other than nmi when set to 1. (nmi is accepted regardless of the i bit setting.) the i bit is set to 1 by hardware at the start of an exception- handling sequence. for details, refer to section 5, interrupt controller. bit 6?user bit or interrupt mask bit (ui): can be written and read by software using the ldc, stc, andc, orc, and xorc instructions. with the h8s/2319 group, this bit cannot be used as an interrupt mask bit. bit 5?half-carry flag (h): when the add.b, addx.b, sub.b, subx.b, cmp.b, or neg.b instruction is executed, this flag is set to 1 if th ere is a carry or borrow at bit 3, and cleared to 0 otherwise. when the add.w, sub.w, cmp.w, or neg.w instruction is executed, the h flag is set to 1 if there is a carry or borrow at bit 11, and cleared to 0 otherwise. when the add.l, sub.l, cmp.l, or neg.l instruction is executed, the h flag is set to 1 if there is a carry or borrow at bit 27, and cleared to 0 otherwise. bit 4?user bit (u): can be written and read by software using the ldc, stc, andc, orc, and xorc instructions. bit 3?negative flag (n): stores the value of the most significant bit (sign bit) of data. bit 2?zero flag (z): set to 1 to indicate zero data, and cl eared to 0 to indicate non-zero data. bit 1?overflow flag (v): set to 1 when an arithmetic overflow occurs, and cleared to 0 at other times. bit 0?carry flag (c): set to 1 when a carry occurs, and cleared to 0 otherwise. used by: ? add instructions, to indicate a carry ? subtract instructions, to indicate a borrow ? shift and rotate instructions, to store the value shifted out of the end bit the carry flag is also used as a bit accu mulator by bit manipulation instructions. some instructions leave some or all of the flag bits unchanged. for the action of each instruction on the flag bits, refer to appendix a.1, instruction list.
section 2 cpu rev.7.00 feb. 14, 2007 page 38 of 1108 rej09b0089-0700 operations can be performed on the ccr bits by the ldc, stc, andc, orc, and xorc instructions. the n, z, v, and c flags are used as branching conditions for conditional branch (bcc) instructions. 2.4.4 initial register values reset exception handling loads the cpu's program counter (pc) from the vector table, clears the trace bit in exr to 0, and sets the interrupt mask bits in ccr and exr to 1. the other ccr bits and the general registers are not initialized. in par ticular, the stack pointer (er7) is not initialized. the stack pointer should therefore be initialized by an mov.l instruction executed immediately after a reset. 2.5 data formats the cpu can process 1-bit, 4-bit (bcd), 8-bit (byte), 16-bit (word), and 32-bit (longword) data. bit-manipulation instructions operate on 1-bit data by accessing bit n (n = 0, 1, 2, ?, 7) of byte operand data. the daa and das decimal-adjust instructions treat byte data as two digits of 4-bit bcd data.
section 2 cpu rev.7.00 feb. 14, 2007 page 39 of 1108 rej09b0089-0700 2.5.1 general register data formats figure 2.7 shows the data formats in general registers. 7 65 43210 d on't care 70 d on't care 7 65 43210 43 70 70 d on't care u pper lower lsb m sb lsb data type r egi s ter number data format 1-bit data 1-bit data 4-bit bc d data 4-bit bc d data byte data byte data rnh rnl rnh rnl rnh rnl m sb d on't care u pper lower 43 70 d on't care 70 d on't care 70 figure 2.7 general register data formats
section 2 cpu rev.7.00 feb. 14, 2007 page 40 of 1108 rej09b0089-0700 0 msb lsb 15 word data word data rn en 0 lsb 15 16 msb 31 en rn general register er general register e general register r general register rh general register rl most significant bit least significant bit legend: ern: en: rn: rnh: rnl: msb: lsb: 0 msb lsb 15 longword data ern data type register number data format figure 2.7 general register data formats (cont)
section 2 cpu rev.7.00 feb. 14, 2007 page 41 of 1108 rej09b0089-0700 2.5.2 memory data formats figure 2.8 shows the data formats in memory. the cpu can access word data and longword data in memory, but word or longword data must begin at an even address. if an attempt is made to access word or longword data at an odd address, no address error occurs but the least significant bit of the address is regarded as 0, so the access st arts at the preceding address. this also applies to instruction fetches. 7 65 43210 70 m sb lsb m sb lsb m sb lsb data type data format 1-bit data byte data word data longword data a ddress a ddress l a ddress l a ddress 2 m a ddress 2 m + 1 a ddress 2n a ddress 2n + 1 a ddress 2n + 2 a ddress 2n + 3 figure 2.8 memory data formats when er7 is used as an address register to access the stack, the operand size should be word size or longword size.
section 2 cpu rev.7.00 feb. 14, 2007 page 42 of 1108 rej09b0089-0700 2.6 instruction set 2.6.1 overview the h8s/2000 cpu has 65 types of instructions. the instructions are classified by function in table 2.1. table 2.1 instruction classification function instructions size types data transfer mov bwl 5 pop * 1 , push * 1 wl ldm, stm l movfpe, movtpe * 3 b add, sub, cmp, neg bwl 19 arithmetic operations addx, subx, daa, das b inc, dec bwl adds, subs l mulxu, divxu, mulxs, divxs bw extu, exts wl tas * 4 b logic operations and, or, xor, not bwl 4 shift shal, shar, shll, shlr, ro tl, rotr, rotxl, rotxr bwl 8 bit manipulation bset, bclr, bnot, btst, bld, bild, bst, bist, band, biand, bor, bior, bxor, bixor b 14 branch bcc * 2 , jmp, bsr, jsr, rts ? 5 system control trapa, rte, sleep, ldc, stc, andc, orc, xorc, nop ? 9 block data transfer eepmov ? 1 total 65 legend: b: byte w: word l: longword notes: 1. pop.w rn and push.w rn are identical to mov.w @sp+, rn and mov.w rn, @-sp. pop.l ern and push.l ern are identical to mov.l @sp+, ern and mov.l ern, @-sp. 2. bcc is the general name for conditional branch instructions. 3. cannot be used in the h8s/2319 group. 4. only register er0, er1, er4, or er5 should be used when using the tas instruction.
section 2 cpu rev.7.00 feb. 14, 2007 page 43 of 1108 rej09b0089-0700 2.6.2 instructions and addressing modes table 2.2 indicates the combinations of instructions and addressing modes that the h8s/2600 cpu can use. table 2.2 combinations of instructions and addressing modes a ddr essi ng m od es f unct i on d ata transfer a r i thmet i c operat i ons i n s truct i on #xx r n @er n @ (d :16,er n) @ (d :32,er n) @ ? er n /@er n + @ aa :8 @ aa :16 @ aa :24 @ aa :32 @ (d :8,pc ) @ (d :16,pc ) @@ aa :8 ? l og i c operat i ons system contro l b l ock data transfer sh i ft b i t man i pu l at i on branch l egend : s iz e refers to the operand s iz e . b : byte w : word l: l ongword n otes : 1 . cannot be used i n the h 8s / 231 9 g roup . 2 . o n l y reg i ster e r0 , e r1 , e r 4, or e r 5 shou l d be used when us i ng the ta s i nstruct i on . mov bw l bw l bw l bw l bw l bw l b bw l ? bw l ? ? ? ? p o p , p u s h ? ? ? ? ? ? ? ? ? ? ? ? ? w l ldm, s tm ? ? ? ? ? ? ? ? ? ? ? ? ? l movf p e, ? ? ? ? ? ? ? b ? ? ? ? ? ? movt p e * 1 add, c m p bw l bw l ? ? ? ? ? ? ? ? ? ? ? ? s u b w l bw l ? ? ? ? ? ? ? ? ? ? ? ? add x , s u bx b b ? ? ? ? ? ? ? ? ? ? ? ? add s , s u bs ? l ? ? ? ? ? ? ? ? ? ? ? ? in c , de c ? bw l ? ? ? ? ? ? ? ? ? ? ? ? daa, da s ? b ? ? ? ? ? ? ? ? ? ? ? ? mul x u, ? bw ? ? ? ? ? ? ? ? ? ? ? ? div x u mul xs , ? bw ? ? ? ? ? ? ? ? ? ? ? ? div xs neg ? bw l ? ? ? ? ? ? ? ? ? ? ? ? e x tu, e x t s ? w l ? ? ? ? ? ? ? ? ? ? ? ? ta s * 2 ? ? b ? ? ? ? ? ? ? ? ? ? ? and, o r , bw l bw l ? ? ? ? ? ? ? ? ? ? ? ? x o r not ? bw l ? ? ? ? ? ? ? ? ? ? ? ? ? bw l ? ? ? ? ? ? ? ? ? ? ? ? ? b b ? ? ? b b ? b ? ? ? ? bcc , bsr ? ? ? ? ? ? ? ? ? ? ? ? jm p , j sr ? ? ? ? ? ? ? ? ? ? ? ? r t s ? ? ? ? ? ? ? ? ? ? ? ? ? t r a p a ? ? ? ? ? ? ? ? ? ? ? ? ? r te ? ? ? ? ? ? ? ? ? ? ? ? ? s lee p ? ? ? ? ? ? ? ? ? ? ? ? ? ld c b b w w w w ? w ? w ? ? ? ? s t c ? b w w w w ? w ? w ? ? ? ? and c , b ? ? ? ? ? ? ? ? ? ? ? ? ? o rc , x o rc no p ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bw
section 2 cpu rev.7.00 feb. 14, 2007 page 44 of 1108 rej09b0089-0700 2.6.3 table of instructions classified by function table 2.3 summarizes the instructions in each functional category. the notation used in table 2.3 is defined below. operation notation rd general register (destination) * rs general register (source) * rn general register * ern general register (32-bit register) (ead) destination operand (eas) source operand exr extended control register ccr condition-code register n n (negative) flag in ccr z z (zero) flag in ccr v v (overflow) flag in ccr c c (carry) flag in ccr pc program counter sp stack pointer #imm immediate data disp displacement + addition ? subtraction multiplication division logical and logical or logical exclusive or move ? not (logical complement) :8/:16/:24/:32 8-, 16-, 24-, or 32-bit length note: * general registers include 8-bit registers (r0h to r7h, r0l to r7l), 16-bit registers (r0 to r7, e0 to e7), and 32-bit registers (er0 to er7).
section 2 cpu rev.7.00 feb. 14, 2007 page 45 of 1108 rej09b0089-0700 table 2.3 instructions cl assified by function type instruction size * 1 function data transfer mov b/w/l (eas) rd, rs (ead) moves data between two general registers or between a general register and memory, or moves immediate data to a general register. movfpe b cannot be used in the h8s/2319 group. movtpe b cannot be used in the h8s/2319 group. pop w/l @sp+ rn pops a register from the stack. pop.w rn is identical to mov.w @sp+, rn. pop.l ern is identical to mov.l @sp+, ern. push w/l rn @?sp pushes a register onto the stack. push.w rn is identical to mov.w rn, @?sp. push.l ern is identical to mov.l ern, @?sp. ldm l @sp+ rn (register list) pops two or more general registers from the stack. stm l rn (register list) @?sp pushes two or more general registers onto the stack.
section 2 cpu rev.7.00 feb. 14, 2007 page 46 of 1108 rej09b0089-0700 type instruction size * 1 function arithmetic operations add sub b/w/l rd rs rd, rd #imm rd performs addition or subtraction on data in two general registers, or on immediate data and data in a general register. (immediate byte data cannot be subtracted from byte data in a general register. use the subx or add instruction.) addx subx b rd rs c rd, rd #imm c rd performs addition or subtraction with carry or borrow on byte data in two general registers, or on immediate data and data in a general register. inc dec b/w/l rd 1 rd, rd 2 rd increments or decrements a general register by 1 or 2. (byte operands can be incremented or decremented by 1 only.) adds subs l rd 1 rd, rd 2 rd, rd 4 rd a dds or subtracts the value 1, 2, or 4 to or from data in a 32-bit register. daa das b rd decimal adjust rd decimal-adjusts an addition or subtraction result in a general register by referring to the ccr to produce 4-bit bcd data. mulxu b/w rd rs rd performs unsigned multiplication on data in two general registers: either 8 bits 8 bits 16 bits or 16 bits 16 bits 32 bits. mulxs b/w rd rs rd performs signed multiplication on data in two general registers: either 8 bits 8 bits 16 bits or 16 bits 16 bits 32 bits. divxu b/w rd rs rd performs unsigned division on data in two general registers: either 16 bits 8 bits 8-bit quotient and 8-bit remainder or 32 bits 16 bits 16-bit quotient and 16- bit remainder.
section 2 cpu rev.7.00 feb. 14, 2007 page 47 of 1108 rej09b0089-0700 type instruction size * 1 function arithmetic operations divxs b/w rd rs rd performs signed division on data in two general registers: either 16 bits 8 bits 8-bit quotient and 8-bit remainder or 32 bits 16 bits 16-bit quotient and 16- bit remainder. cmp b/w/l rd ? rs, rd ? #imm compares data in a general register with data in another general register or with immediate data, and sets ccr bits according to the result. neg b/w/l 0 ? rd rd takes the two's complement (arithmetic complement) of data in a general register. extu w/l rd (zero extension) rd extends the lower 8 bits of a 16-bit register to word size, or the lower 16 bits of a 32-bit register to longword size, by padding with zeros on the left. exts w/l rd (sign extension) rd extends the lower 8 bits of a 16-bit register to word size, or the lower 16 bits of a 32-bit register to longword size, by extending the sign bit. tas b @erd ? 0, 1 ( of @erd) * 2 tests memory contents, and sets the most significant bit (bit 7) to 1.
section 2 cpu rev.7.00 feb. 14, 2007 page 48 of 1108 rej09b0089-0700 type instruction size * 1 function logic operations and b/w/l rd rs rd, rd #imm rd performs a logical and operation on a general register and another general register or immediate data. or b/w/l rd rs rd, rd #imm rd performs a logical or operation on a general register and another general register or immediate data. xor b/w/l rd rs rd, rd #imm rd performs a logical exclusive or operation on a general register and another general register or immediate data. not b/w/l ? (rd) (rd) takes the one's complement of general register contents. shift operations shal shar b/w/l rd (shift) rd performs an arithmetic shift on general register contents. 1-bit or 2-bit shift is possible. shll shlr b/w/l rd (shift) rd performs a logical shift on general register contents. 1-bit or 2-bit shift is possible. rotl rotr b/w/l rd (rotate) rd rotates general register contents. 1-bit or 2-bit rotation is possible. rotxl rotxr b/w/l rd (rotate) rd rotates general register contents through the carry flag. 1-bit or 2-bit rotation is possible.
section 2 cpu rev.7.00 feb. 14, 2007 page 49 of 1108 rej09b0089-0700 type instruction size * 1 function bit- manipulation instructions bset b 1 ( of ) sets a specified bit in a general register or memory operand to 1. the bit number is specified by 3-bit immediate data or the lower three bits of a general register. bclr b 0 ( of ) clears a specified bit in a general register or memory operand to 0. the bit number is specified by 3-bit immediate data or the lower three bits of a general register. bnot b ? ( of ) ( of ) inverts a specified bit in a general register or memory operand. the bit number is specified by 3-bit immediate data or the lower three bits of a general register. btst b ? ( of ) z tests a specified bit in a general register or memory operand and sets or clears the z flag accordingly. the bit number is specified by 3-bit immediate data or the lower three bits of a general register. band biand b b c ( of ) c ands the carry flag with a specified bit in a general register or memory operand and stores the result in the carry flag. c ? ( of ) c ands the carry flag with the inverse of a specified bit in a general register or memory operand and stores the result in the carry flag. the bit number is specified by 3-bit immediate data. bor bior b b c ( of ) c ors the carry flag with a specified bit in a general register or memory operand and stores the result in the carry flag. c ? ( of ) c ors the carry flag with the inverse of a specified bit in a general register or memory operand and stores the result in the carry flag. the bit number is specified by 3-bit immediate data.
section 2 cpu rev.7.00 feb. 14, 2007 page 50 of 1108 rej09b0089-0700 type instruction size * 1 function bit- manipulation instructions bxor bixor b b c ( of ) c exclusive-ors the carry flag with a specified bit in a general register or memory operand and stores the result in the carry flag. c ? ( of ) c exclusive-ors the carry flag with the inverse of a specified bit in a general register or memory operand and stores the result in the carry flag. the bit number is specified by 3-bit immediate data. bld bild b b ( of ) c transfers a specified bit in a general register or memory operand to the carry flag. ? ( of ) c transfers the inverse of a specified bit in a general register or memory operand to the carry flag. the bit number is specified by 3-bit immediate data. bst bist b b c ( of ) transfers the carry flag value to a specified bit in a general register or memory operand. ? c ( of ) transfers the inverse of the carry flag value to a specified bit in a general register or memory operand. the bit number is specified by 3-bit immediate data.
section 2 cpu rev.7.00 feb. 14, 2007 page 51 of 1108 rej09b0089-0700 type instruction size function branch instructions bcc ? branches to a specified relative address if a specified condition is true. the branching conditions are listed below. mnemonic description condition bra(bt) always (true) always brn(bf) never (false) never bhi high c z = 0 bls low or same c z = 1 bcc(bhs) carry clear (high or same) c = 0 bcs(blo) carry set (low) c = 1 bne not equal z = 0 beq equal z = 1 bvc overflow clear v = 0 bvs overflow set v = 1 bpl plus n = 0 bmi minus n = 1 bge greater or equal n v = 0 blt less than n v = 1 bgt greater than z (n v) = 0 ble less or equal z (n v) = 1 jmp ? branches unconditionally to a specified absolute address. bsr ? branches to a subroutine at a specified relative address. jsr ? branches to a subroutine at a specified absolute address. rts ? returns from a subroutine.
section 2 cpu rev.7.00 feb. 14, 2007 page 52 of 1108 rej09b0089-0700 type instruction size * 1 function trapa ? starts trap-instruction exception handling. rte ? returns from an exception-handling routine. sleep ? causes a transition to a power-down state. system control instructions ldc b/w (eas) ccr, (eas) exr moves the source operand contents or immediate data to ccr or exr. although ccr and exr are 8-bit registers, word-size transfers are performed between them and memory. the upper 8 bits are valid. stc b/w ccr (ead), exr (ead) transfers ccr or exr contents to a general register or memory. although ccr and exr are 8-bit registers, word-size transfers are performed between them and memory. the upper 8 bits are valid. andc b ccr #imm ccr, exr #imm exr logically ands the ccr or exr contents with immediate data. orc b ccr #imm ccr, exr #imm exr logically ors the ccr or exr contents with immediate data. xorc b ccr #imm ccr, exr #imm exr logically exclusive-ors the ccr or exr contents with immediate data. nop ? pc + 2 pc only increments the program counter.
section 2 cpu rev.7.00 feb. 14, 2007 page 53 of 1108 rej09b0089-0700 type instruction size function block data transfer instruction eepmov.b eepmov.w ? ? if r4l 0 then repeat @er5+ @er6+ r4l?1 r4l until r4l = 0 else next; if r4 0 then repeat @er5+ @er6+ r4?1 r4 until r4 = 0 else next; transfers a data block according to parameters set in general registers r4l or r4, er5, and er6. r4l or r4: size of block (bytes) er5: starting source address er6: starting destination address execution of the next instruction begins as soon as the transfer is completed. notes: 1. size refers to the operand size. b: byte w: word l: longword 2. only register er0, er1, er4, or er5 should be used when using the tas instruction.
section 2 cpu rev.7.00 feb. 14, 2007 page 54 of 1108 rej09b0089-0700 2.6.4 basic instruction formats the cpu instructions consist of 2-byte (1-word) units. an instruction consists of an operation field (op field), a register field (r field), an effective address extension (ea field), and a condition field (cc). figure 2.9 shows examples of instruction formats. op op rn rm n o p , rts , etc. add .b rn , rm , etc. mov .b @(d:1 6, rn) , rm , etc. (1) o peration field only (2) o peration field and register fields (3) o peration field , register fields , and effective address extension rn rm op e a (disp) (4) o peration field , effective address extension , and condition field op cc e a (disp) br a d:1 6, etc figure 2.9 instruction formats (examples) (1) operation field: indicates the function of the instruction, the addressing mode, and the operation to be carried out on the operand. the operation field always includes the first four bits of the instruction. some instructions have two operation fields. (2) register field: specifies a general register. address registers are specified by 3 bits, data registers by 3 bits or 4 bits. some instructions have two register fields. some have no register field. (3) effective address extension: eight, 16, or 32 bits specifying immediate data, an absolute address, or a displacement. (4) condition field: specifies the branching condition of bcc instructions.
section 2 cpu rev.7.00 feb. 14, 2007 page 55 of 1108 rej09b0089-0700 2.7 addressing modes and eff ective address calculation 2.7.1 addressing mode the cpu supports the eight addressing modes listed in table 2.4. each instruction uses a subset of these addressing modes. arithmetic and logic instructions can use the register direct and immediate modes. data transfer instructions can use all addressing modes except program-counter relative and memory indirect. bit manipulation instructions use register direct, register indirect, or absolute addressing mode to specify an operand, and register direct (bset, bclr, bnot, and btst instructions) or immediate (3-bit) addressi ng mode to specify a bit number in the operand. table 2.4 addressing modes no. addressing mode symbol 1 register direct rn 2 register indirect @ern 3 register indirect with displacement @(d:16,ern)/@(d:32,ern) 4 register indirect with post-increment register indirect with pre-decrement @ern+ @?ern 5 absolute address @aa:8/@aa:16/@aa:24/@aa:32 6 immediate #xx:8/#xx:16/#xx:32 7 program-counter relative @(d:8,pc)/@(d:16,pc) 8 memory indirect @@aa:8 (1) register direct?rn: the register field of the instruction specifies an 8-, 16-, or 32-bit general register containing the operand. r0h to r7h and r0l to r7l can be specified as 8-bit registers. r0 to r7 and e0 to e7 can be specified as 16-bit registers. er0 to er7 can be specified as 32-bit registers. (2) register indirect?@ern: the register field of the instruction code specifies an address register (ern) which contains the address of the operand on memory. if the address is a program instruction address, the lower 24 bits are valid and the upper 8 bits are all assumed to be 0 (h'00). (3) register indirect with displaceme nt?@(d:16, ern) or @(d:32, ern): a 16-bit or 32-bit displacement contained in the instruction is added to an address register (ern) specified by the register field of the instruction, and the sum gives the address of a memory operand. a 16-bit displacement is sign-extended when added.
section 2 cpu rev.7.00 feb. 14, 2007 page 56 of 1108 rej09b0089-0700 (4) register indirect with post-increment or pre-decrement?@ern+ or @-ern: ? register indirect with post-increment?@ern+ the register field of the instruction code specifies an address register (ern) which contains the address of a memory operand. after the operand is accessed, 1, 2, or 4 is added to the address register contents and the sum is stored in the address register. the value added is 1 for byte access, 2 for word transfer instruction, or 4 fo r longword transfer instruction. for word or longword transfer instruction, th e register value should be even. ? register indirect with pre-decrement?@-ern the value 1, 2, or 4 is subtracted from an address register (ern) specified by the register field in the instruction code, and the result becomes the address of a memory operand. the result is also stored in the address register. the value subt racted is 1 for byte access, 2 for word transfer instruction, or 4 for longword transfer instruction. for word or longword transfer instruction, the register value should be even. (5) absolute address?@aa:8, @aa:16, @aa:24, or @aa:32: the instruction code contains the absolute address of a memory operand. the absolute address may be 8 bits long (@aa:8), 16 bits long (@aa:16), 24 bits long (@aa:24), or 32 bits long (@aa:32). to access data, the absolute address should be 8 bits (@aa:8), 16 bits (@aa:16), or 32 bits (@aa:32) long. for an 8-bit absolute address, th e upper 24 bits are all assumed to be 1 (h'ffff). for a 16-bit absolute address the upper 16 bits ar e a sign extension. a 32-bit absolute address can access the entire address space. a 24-bit absolute address (@aa:24) indicates the address of a program instruction. the upper 8 bits are all assumed to be 0 (h'00). table 2.5 indicates the accessible absolute address ranges. table 2.5 absolute address access ranges absolute address advanced mode data address 8 bits (@aa:8) h'ffff00 to h'ffffff 16 bits (@aa:16) h'000000 to h'007fff, h'ff8000 to h'ffffff 32 bits (@aa:32) h'000000 to h'ffffff program instruction address 24 bits (@aa:24)
section 2 cpu rev.7.00 feb. 14, 2007 page 57 of 1108 rej09b0089-0700 (6) immediate?#xx:8, #xx:16, or #xx:32: the instruction contains 8-bit (#xx:8), 16-bit (#xx:16), or 32-bit (#xx:32) immediate data as an operand. the adds, subs, inc, and dec instructions contain immediate data implicitly. some bit manipulation instructions contain 3-bit immediate data in the instruction code, specifying a bit number. the trapa instruction contains 2-bit immediate data in its instruction code, specifying a vector address. (7) program-counter relative?@(d:8, pc) or @(d:16, pc): this mode is used in the bcc and bsr instructions. an 8-bit or 16-bit displacement contained in the instruction is sign-extended and added to the 24-bit pc contents to generate a branch address. only the lower 24 bits of this branch address are valid; the upper 8 bits are all assumed to be 0 (h'00). the pc value to which the displacement is added is the address of the first byte of the next instruction, so the possible branching range is ?126 to +128 bytes (?63 to +64 words) or ?32766 to +32768 bytes (?16383 to +16384 words) from the branch instruction. the resulting value should be an even number. (8) memory indirect?@@aa:8: this mode can be used by the jmp and jsr instructions. the instruction code contains an 8-bit absolute address specifying a memory operand. this memory operand contains a branch address. the upper bits of the absolute address are all assumed to be 0, so the address range is 0 to 255 (h'000000 to h'0000ff). in advanced mode the memory operand is a longword operand, the first byte of which is assumed to be all 0 (h'00). note that the first part of the address range is also the exception vector area. for further details, refer to section 4, exception handling. advanced mode specified by @aa:8 reserved branch address figure 2.10 branch a ddress specification in memory indirect mode
section 2 cpu rev.7.00 feb. 14, 2007 page 58 of 1108 rej09b0089-0700 if an odd address is specified in word or longword memory access, or as a branch address, the least significant bit is regarded as 0, causing data to be accessed or instruction code to be fetched at the address preceding the specified address (for further information, see section 2.5.2, memory data formats). 2.7.2 effective address calculation table 2.6 indicates how effective addresses are calculated in each addressing mode.
section 2 cpu rev.7.00 feb. 14, 2007 page 59 of 1108 rej09b0089-0700 table 2.6 effective address calculation reg i ster i nd i rect w i th post -i ncrement or pre - decrement reg i ster i nd i rect w i th post -i ncrement @ e rn + n o .a ddr essi ng m od e and i n s truct i on f ormat effe ct i v e a ddr ess c a l cu l at i on effe ct i v e a ddr ess ( ea ) 1 reg i ster d i rect (rn) op rm rn o perand i s genera l reg i ster contents . reg i ster i nd i rect (@ e rn) 2 reg i ster i nd i rect w i th d i sp l acement @(d : 1 6, e rn) or @(d : 32 , e rn) 3 reg i ster i nd i rect w i th pre - decrement @ ? e rn 4 g enera l reg i ster contents g enera l reg i ster contents s i gn extens i on d i sp g enera l reg i ster contents 1 , 2 , or 4 g enera l reg i ster contents 1 , 2 , or 4 byte word l ongword 1 2 4 o perand s iz e v a l ue added 31 0 31 0 31 0 31 0 31 0 31 0 31 0 31 0 31 0 op r r op op r r op d i sp 2 4 23 d on ' t care 2 4 23 d on ' t care 2 4 23 d on ' t care 2 4 23 d on ' t care
section 2 cpu rev.7.00 feb. 14, 2007 page 60 of 1108 rej09b0089-0700 5 @aa : 8 a bso l ute address @aa : 1 6 @aa : 32 6 i mmed i ate # xx : 8 /# xx : 1 6/# xx : 32 31 0 8 7 o perand i s i mmed i ate data . n o .a ddr essi ng m od e and i n s truct i on f ormat effe ct i v e a ddr ess c a l cu l at i on effe ct i v e a ddr ess ( ea ) @aa : 2 4 31 0 1 6 1 5 31 0 2 4 23 31 0 op abs op abs abs op op abs op imm h'ffff d on ' t care 2 4 23 d on ' t care 2 4 23 d on ' t care 2 4 23 d on ' t care s i gn extens i on
section 2 cpu rev.7.00 feb. 14, 2007 page 61 of 1108 rej09b0089-0700 31 0 0 7 program - counter re l at i ve @(d : 8 , pc) / @(d : 1 6, pc) 8 m emory i nd i rect @@aa : 8 a dvanced mode n o .a ddr essi ng m od e and i n s truct i on f ormat effe ct i v e a ddr ess c a l cu l at i on effe ct i v e a ddr ess ( ea ) 23 23 0 31 8 7 0 d i sp abs h' 000000 31 0 2 4 23 31 0 2 4 23 op d i sp op abs s i gn extens i on pc contents m emory contents d on ' t care d on ' t care
section 2 cpu rev.7.00 feb. 14, 2007 page 62 of 1108 rej09b0089-0700 2.8 processing states 2.8.1 overview the cpu has five main processing states: the reset state, exception handling state, program execution state, bus-released state, and power-down state. figure 2.11 shows a diagram of the processing states. figure 2.12 indicates the state transitions. reset state the cp u and all on-chip supporting modules have been initiali z ed and are stopped. exception-handling state a transient state in which the cp u changes the normal processing flow in response to a reset , interrupt , or trap instruction. program execution state the cp u executes program instructions in sequence. bus-released state the external bus has been released in response to a bus request signal from a bus master other than the cp u . power-down state cp u operation is stopped to conserve power. * sleep mode software standby mode hardware standby mode processing states note: * the power-down state also includes a medium-speed mode , module stop mode etc. figure 2.11 processing states
section 2 cpu rev.7.00 feb. 14, 2007 page 63 of 1108 rej09b0089-0700 end of bus request bus request program execution state bus-released state sleep mode exception-handling state external interrupt software standby mode res = high reset state stby = high , res = low hardware standby mode * 2 power-down state * 1 notes: 1. 2. from any state except hardware standby mode , a transition to the reset state occurs whenever res goes low. a transition can also be made to the reset state when the watchdog timer overflows. from any state , a transition to hardware standby mode occurs when stby goes low. sleep instruction with ssby = 0 sleep instruction with ssby = 1 interrupt request end of bus request bus request request for exception handling end of exception handling figure 2.12 state transitions 2.8.2 reset state when the res input goes low all current processing stops and the cpu enters the reset state. all interrupts are masked in the reset state. reset exception handling starts when the res signal changes from low to high. the reset state can also be entered by a watchdog timer overflow. for details, refer to section 11, watchdog timer.
section 2 cpu rev.7.00 feb. 14, 2007 page 64 of 1108 rej09b0089-0700 2.8.3 exception-handling state the exception-handling state is a transient state that occurs when the cpu alters the normal processing flow due to a reset, interrupt, or trap instruction. the cpu fetches a start address (vector) from the exception vector table and branches to that address. (1) types of exception ha ndling and their priority exception handling is performed for traces, resets, interrupts, and trap instructions. table 2.7 indicates the types of exception handling and their priority. trap instruction exception handling is always accepted, in the program execution state. exception handling and the stack structure depend on the interrupt control mode set in syscr. table 2.7 exception handling types and priority priority type of exception detection timing start of exception handling high reset synchronized with clock exception handling starts immediately after a low-to-high transition at the res pin, or when the watchdog timer overflows. trace end of instruction execution or end of exception-handling sequence * 1 when the trace (t) bit is set to 1, the trace starts at the end of the current instruction or current exception-handling sequence. interrupt end of instruction execution or end of exception-handling sequence * 2 when an interrupt is requested, exception handling starts at the end of the current instruction or current exception-handling sequence. low trap instruction when trapa instruction is executed exception handling starts when a trap (trapa) instruction is executed * 3 . notes: 1. traces are enabled only in interrupt control mode 2. trace exception-handling is not executed at the end of the rte instruction. 2. interrupts are not detected at the end of the andc, orc, xorc, and ldc instructions, or immediately after reset exception handling. 3. trap instruction exception handling is always accepted, in the program execution state.
section 2 cpu rev.7.00 feb. 14, 2007 page 65 of 1108 rej09b0089-0700 (2) reset exception handling after the res pin has gone low and the reset state has been entered, when res goes high again, reset exception handling starts. when reset exception handling starts the cpu fetches a start address (vector) from the exception vector table and starts program execution from that address. all interrupts, including nmi, are disabled during reset exception handling and after it ends. (3) traces traces are enabled only in interrupt control mode 2. trace mode is entered when the t bit of exr is set to 1. when trace mode is established, trace exception handling starts at the end of each instruction. at the end of a trace exception-handling sequence, the t bit of exr is cleared to 0 and trace mode is cleared. interrupt masks are not affected. the t bit saved on the stack retains its value of 1, and when the rte instruction is executed to return from the trace exception-handling routine, trace mode is entered again. trace exception- handling is not executed at the end of the rte instruction. trace mode is not entered in interrupt control mode 0, regardless of the state of the t bit. (4) interrupt exception handling and trap instruction exception handling when interrupt or trap-instruction exception handling begins, the cpu references the stack pointer (er7) and pushes the program counter and other control registers onto the stack. next, the cpu alters the settings of the interrupt mask bits in the control registers. then the cpu fetches a start address (vector) from the exception vector table and program execution starts from that start address. figure 2.13 shows the stack after exception handling ends.
section 2 cpu rev.7.00 feb. 14, 2007 page 66 of 1108 rej09b0089-0700 (c) interrupt control mode 0 (d) interrupt control mode 2 ccr pc (24 bits) sp note: * ignored when returning. ccr pc (24 bits) sp exr reserved * a dvanced mode figure 2.13 stack structure aft er exception handling (examples) 2.8.4 program execution state in this state the cpu executes program instructions in sequence. 2.8.5 bus-released state this is a state in which the bus has been released in response to a bus request from a bus master other than the cpu. while the bus is released, the cpu halts. there is one other bus master in addition to the cpu: the data transfer controller (dtc). for further details, refer to section 6, bus controller. 2.8.6 power-down state the power-down state includes both modes in which the cpu stops operating and modes in which the cpu does not stop. there are three modes in which the cpu stops operating: sleep mode, software standby mode, and hardware standby mode. there are also two other power-down modes: medium-speed mode, and module stop mode. in medium-speed mode the cpu and other
section 2 cpu rev.7.00 feb. 14, 2007 page 67 of 1108 rej09b0089-0700 bus masters operate on a medium-speed clock. module stop mode permits halting of the operation of individual modules, other than the cpu. for details, refer to section 19, power-down modes. (1) sleep mode: a transition to sleep mode is made if the sleep instruction is executed while the software standby bit (ssby) in the standby cont rol register (sbycr) is cleared to 0. in sleep mode, cpu operations stop immediately after execution of the sleep instruction. the contents of cpu registers are retained. (2) software standby mode: a transition to software standby mode is made if the sleep instruction is executed while the ssby bit in sbycr is set to 1. in software standby mode, the cpu and clock halt and all mcu operations stop. as long as a specified voltage is supplied, the contents of cpu registers and on-chip ram are retained. the i/o ports also remain in their existing states. (3) hardware standby mode: a transition to hardware standby mode is made when the stby pin goes low. in hardware standby mode, the cpu and clock halt and all mcu operations stop. the on-chip supporting modules are reset, but as long as a specified voltage is supplied, on-chip ram contents are retained. 2.9 basic timing 2.9.1 overview the cpu is driven by a system clock, denoted by the symbol . the period from one rising edge of to the next is referred to as a "state." the memory cycle or bus cycle consists of one, two, or three states. different methods are used to access on-chip memory, on-chip supporting modules, and the external address space. 2.9.2 on-chip memory (rom, ram) on-chip memory is accessed in one state. the data bus is 16 bits wide, permitting both byte and word transfer instruction. figure 2.14 shows the on-chip memory access cycle. figure 2.15 shows the pin states.
section 2 cpu rev.7.00 feb. 14, 2007 page 68 of 1108 rej09b0089-0700 internal address bus internal read signal internal data bus internal write signal internal data bus bus cycle t 1 a ddress read data write data read access write access figure 2.14 on-chip memory access cycle bus cycle t 1 u nchanged a ddress bus as rd hwr , lwr d ata bus high high high high-impedance state figure 2.15 pin states dur ing on-chip memory access
section 2 cpu rev.7.00 feb. 14, 2007 page 69 of 1108 rej09b0089-0700 2.9.3 on-chip supporting module access timing the on-chip supporting modules are accessed in two states. the data bus is either 8 bits or 16 bits wide, depending on the particular internal i/ o register being accessed. figure 2.16 shows the access timing for the on-chip supporting modules. figure 2.17 shows the pin states. bus cycle t 1 t 2 a ddress read data write data internal read signal internal data bus internal write signal internal data bus read access write access internal address bus figure 2.16 on-chip supporting module access cycle
section 2 cpu rev.7.00 feb. 14, 2007 page 70 of 1108 rej09b0089-0700 bus cycle t 1 t 2 u nchanged a ddress bus as rd hwr , lwr d ata bus high high high high-impedance state figure 2.17 pin states during on-chip supporting module access 2.9.4 external address space access timing the external address space is accessed with an 8-bit or 16-bit data bus width in a two-state or three-state bus cycle. in three-state access, wait states can be inserted. for further details, refer to section 6, bus controller. 2.10 usage note 2.10.1 tas instruction only register er0, er1, er4, or er5 should be used when using the tas instruction. the tas instruction is not generated by the renesas h8s and h8/300 series c/c++ compilers. if the tas instruction is used as a user-defined intrinsic function, ensure that only register er0, er1, er4, or er5 is used.
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 71 of 1108 rej09b0089-0700 section 3 mcu operating modes 3.1 overview 3.1.1 operating mode selection (h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat) the h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat have eight operating modes (modes 4 to 7, 10, 11, 14 and 15). these modes are determined by the mode pin (md2 to md0) and flash write enable pin (fwe) settings. the cpu operating mode and initial bus width can be selected as shown in table 3.1. table 3.1 lists the mcu operating modes. table 3.1 mcu operating mode selection (h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat) external data bus mcu operating mode fwe md2 md1 md0 cpu operating mode description on-chip rom initial value max. value 1 * 0 0 0 1 ? ? ? ? ? 2 * 1 0 3 * 1 4 1 0 0 advanced disabled 16 bits 16 bits 5 1 expanded mode with on-chip rom disabled 8 bits 16 bits 6 1 0 expanded mode with on-chip rom enabled enabled 8 bits 16 bits 7 1 single-chip mode ? ? 8 * 1 0 0 0 ? ? ? ? ? 9 * 1 10 1 0 advanced boot mode enabled 8 bits 16 bits 11 1 ? ? 12 * 1 0 0 ? ? ? ? ? 13 * 1 14 1 0 advanced user program mode enabled 8 bits 16 bits 15 1 ? ? note: * cannot be used in this lsi.
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 72 of 1108 rej09b0089-0700 the cpu's architecture allows for 4 gbytes of address space, but the h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat actually access a maximum of 16 mbytes. modes 4 to 6 are externally expanded modes that allow access to external memory and peripheral devices. the external expansion modes allow switching between 8-bit and 16-bit bus modes. after program execution starts, an 8-bit or 16-bit addr ess space can be set for each area, depending on the bus controller setting. if 16-bit access is selected for any one area, 16-bit bus mode is set; if 8- bit access is selected for all areas, 8-bit bus mode is set. note that the functions of each pin depend on the operating mode. modes 10, 11, 14, and 15 are boot modes and user program modes in which the flash memory can be programmed and erased. for details, see section 17, rom. the h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat can only be used in modes 4 to 7, 10, 11, 14, and 15. this means that the flash write enable pin and mode pins must be set to select one of these modes. do not change the inputs at the mode pins during operation. 3.1.2 operating mode selection (mask rom, romless, h8s/2319 f-ztat, and h8s/2319c f-ztat) the romless and mask rom versions have four operating modes (modes 4 to 7). the h8s/2319 f-ztat has six operating modes (modes 2 to 7). the h8s/2319c f-ztat has seven operating mode (modes 1 to 7). the operating mode is determined by the mode pins (md2 to md0). the cpu operating mode, enabling or disabling of on-chip rom, and the initial bus width setting can be selected as shown in table 3.2. table 3.2 lists the mcu operating modes.
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 73 of 1108 rej09b0089-0700 table 3.2 mcu operating mode selection (mask rom, romless versions, h8s/2319 f- ztat, and h8s/2319c f-ztat) external data bus mcu operating mode md2 md1 md0 cpu operating mode description on-chip rom initial value max. value 1 * 1 0 0 1 ? ? ? ? ? 2 * 2 1 0 3 * 2 1 4 * 3 1 0 0 advanced disabled 16 bits 16 bits 5 * 3 1 expanded mode with on-chip rom disabled 8 bits 16 bits 6 1 0 expanded mode with on-chip rom enabled enabled 8 bits 16 bits 7 1 single-chip mode ? ? notes: 1. user boot mode in the h8s/2319c f-ztat. for user boot mode in the h8s/2319c f-ztat, see table 17.52. 2. boot mode in the h8s/2319 f-ztat and h8s/2319c f-ztat. for boot mode in the h8s/2319 f-ztat, see table 17.30. also see table 17.30, for information on user program mode. for boot mode in the h8s/2319c f-ztat, see table 17.52. also see table 17.52, for information on user program mode. 3. only modes 4 and 5 are provided in the romless versions. the cpu's architecture allows for 4 gbytes of address space, but the mask rom, romless version, h8s/2319 f-ztat, and h8s/2319c f-ztat actually access a maximum of 16 mbytes. modes 4 to 6 are externally expanded modes that allow access to external memory and peripheral devices. the external expansion modes allow switching between 8-bit and 16-bit bus modes. after program execution starts, an 8-bit or 16-bit addr ess space can be set for each area, depending on the bus controller setting. if 16-bit access is selected for any one area, 16-bit bus mode is set; if 8- bit access is selected for all areas, 8-bit bus mode is set. note that the functions of each pin depend on the operating mode. the romless and mask rom versions can only be used in modes 4 to 7. this means that the mode pins must be set to select one of these modes. however, note that only mode 4 or 5 can be set for the romless versions. the h8s/2319 f-ztat can only be used in modes 2 to 7. this means that the mode pins must be set to select one of these modes. the h8s/2319c f-ztat can
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 74 of 1108 rej09b0089-0700 only be used in modes 1 to 7. this means that the mode pins must be set to select one of these modes. do not change the inputs at the mode pins during operation. 3.1.3 register configuration the h8s/2319 group has a mode control register (m dcr) that indicates the inputs at the mode pins (md2 to md0), and a system control regi ster (syscr) and system control register 2 (syscr2) * 2 that control the operation of the chip . table 3.3 summarizes these registers. table 3.3 registers name abbreviation r/w initial value address * 1 mode control register mdcr r undefined h'ff3b system control register syscr r/w h'01 h'ff39 system control register 2 * 2 syscr2 r/w h'00 h'ff42 notes: 1. lower 16 bits of the address. 2. the syscr2 register can only be used in the f-ztat versions. in the mask rom and romless versions this register will return an undefined value if read, and cannot be modified. 3.2 register descriptions 3.2.1 mode control register (mdcr) bit : 7 6 5 4 3 2 1 0 ? ? ? ? ? mds2 mds1 mds0 initial value : 1 0 0 0 0 ? * ? * ? * r/w : ? ? ? ? ? r r r note: * determined by pins md2 to md0. mdcr is an 8-bit read-only register that indicates the current operating mode of the h8s/2319 group chip. bit 7?reserved: this bit is always read as 1, and cannot be modified. bits 6 to 3?reserved: these bits are always read as 0, and cannot be modified.
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 75 of 1108 rej09b0089-0700 bits 2 to 0?mode select 2 to 0 (mds2 to mds0): these bits indicate the input levels at pins md2 to md0 (the current operating mode). bits mds2 to mds0 correspond to pins md2 to md0. mds2 to mds0 are read-only bits, and cannot be written to. the mode pin (md2 to md0) input levels are latched into these bits when mdcr is read. these latches are canceled by a reset. 3.2.2 system control register (syscr) bit : 7 6 5 4 3 2 1 0 ? ? intm1 intm0 nmieg lwrod ? rame initial value : 0 0 0 0 0 0 0 1 r/w : r/w ? r/w r/w r/w r/w r/w r/w bit 7?reserved: only 0 should be written to this bit. bit 6?reserved: this bit is always read as 0, and cannot be modified. bits 5 and 4?interrupt control mode 1 and 0 (intm1, intm0): these bits select the control mode of the interrupt controller. for details of the interrupt control modes, see section 5.4.1, interrupt control modes and interrupt operation. bit 5 intm1 bit 4 intm0 interrupt control mode description 0 0 0 control of interrupts by i bit (initial value) 1 ? setting prohibited 1 0 2 control of interrupts by i2 to i0 bits and ipr 1 ? setting prohibited bit 3?nmi edge select (nmieg): selects the valid edge of the nmi interrupt input. bit 3 nmieg description 0 an interrupt is requested at the falling edge of nmi input (initial value) 1 an interrupt is requested at the rising edge of nmi input
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 76 of 1108 rej09b0089-0700 bit 2?lwr output disable (lwrod): enables or disables lwr output. bit 2 lwrod description 0 pf3 is designated as lwr output pin (initial value) 1 pf3 is designated as i/o port, and does not function as lwr output pin bit 1?reserved: only 0 should be written to this bit. bit 0?ram enable (rame): enables or disables the on-chip ram. the rame bit is initialized when the reset state is released. it is not initialized in software standby mode. bit 0 rame description 0 on-chip ram is disabled 1 on-chip ram is enabled (initial value) 3.2.3 system control register 2 (syscr2) (f-ztat versions only) bit : 7 6 5 4 3 2 1 0 ? ? ? ? flshe ? ? ? initial value : 0 0 0 0 0 0 0 0 r/w : ? ? ? ? r/w ? ? ? (r/w) * note: * r/w in the h8s/2319 f-ztat. syscr2 is an 8-bit readable/writable register that performs on-chip flash memory control. syscr2 is initialized to h'00 by a reset, and in hardware standby mode. bits 7 to 4?reserved: these bits are always read as 0, and cannot be modified. bit 3?flash memory control register enable (flshe): controls cpu access to the flash memory control registers (flmcr1, flmcr2, ebr1, and ebr2 in the case of the h8s/2319 f- ztat, h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat; fccs, fpcs, fecs, fkey, fmats, ftdar, fvarc, fvadrr, fvadre, fvadrh, and fvadrl in the case of the h8s/2319c f-ztat). for details, see section 17, rom.
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 77 of 1108 rej09b0089-0700 bit 3 flshe description 0 h8s/2319 f-ztat, h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat ? flash control registers are not selected for addresses h'ffffc8 to h'ffffcb (initial value) h8s/2319c f-ztat ? flash control registers are not selected for addresses h'ffffc4 to h'ffffcf 1 h8s/2319 f-ztat, h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat ? flash control registers are selected for addresses h'ffffc8 to h'ffffcb h8s/2319c f-ztat ? flash control registers are selected for addresses h'ffffc4 to h'ffffcf bits 2 and 1?reserved: these bits are always read as 0, and cannot be modified. bit 0?reserved: in the h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat, this bit is always read as 0 and cannot be modified. in the h8s/2319 f-ztat or h8s/2319c f-ztat, this bit is reserved and should only be written with 0. 3.3 operating mode descriptions 3.3.1 mode 1 (h8s/2319c f-ztat only) this is a flash memory boot mode. see section 17, rom, for details. except for the fact that flash memory programming and erasing can be performed, operation in this mode is the same as in advanced single-chip mode. 3.3.2 mode 2 (h8s/2319 f-ztat and h8s/2319c f-ztat only) this is a flash memory boot mode. see section 17, rom, for details. except for the fact that flash memory programming and erasing can be performed, operation in this mode is the same as in advanced expanded mode with on-chip rom enabled.
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 78 of 1108 rej09b0089-0700 3.3.3 mode 3 (h8s/2319 f-ztat and h8s/2319c f-ztat only) this is a flash memory boot mode. see section 17, rom, for details. except for the fact that flash memory programming and erasing can be performed, operation in this mode is the same as in advanced single chip mode. 3.3.4 mode 4 (expanded mode with on-chip rom disabled) the cpu can access a 16-mbyte address space in advanced mode. the on-chip rom is disabled. pins p13 to p10, ports a, b, and c function as an address bus, ports d and e functions as a data bus, and part of port f carries bus control signals. pins p13 to p10 function as input ports immediately after a reset. these pins can be set to output addresse by setting the corresponding data direction register (ddr) bits and a23e to a20e in pfcr1 to 1. the initial bus mode after a reset is 16 bits, with 16-bit access to all areas. however, note that if 8-bit access is designated by the bus controller for all areas, the bus mode switches to 8 bits. 3.3.5 mode 5 (expanded mode with on-chip rom disabled) the cpu can access a 16-mbyte address space in advanced mode. the on-chip rom is disabled. pins p13 to p10, ports a, b, and c function as an address bus, port d functions as a data bus, and part of port f carries bus control signals. pins p13 to p10 function as input ports immediately after a reset. these pins can be set to output addresses by setting the corresponding data direction register (ddr) bits and a23e to a20e in pfcr1 to 1. the initial bus mode after a reset is 8 bits, with 8-bit access to all areas. however, note that if at least one area is designated for 16-bit access by the bus controller, the bus mode switches to 16 bits and port e becomes a data bus.
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 79 of 1108 rej09b0089-0700 3.3.6 mode 6 (expanded mode with on-chip rom enabled) the cpu can access a 16-mbyte address space in advanced mode. the on-chip rom is enabled. pins p13 to p10, ports a, b, and c function as input ports immediately after a reset. these pins can be set to output addresses by setting the corresponding data direction register (ddr) bits and a23e to a20e in pfcr1 to 1. port d functions as a data bus, and part of port f carries bus control signals. the initial bus mode after a reset is 8 bits, with 8-bit access to all areas. however, note that if at least one area is designated for 16-bit access by the bus controller, the bus mode switches to 16 bits and port e becomes a data bus. 3.3.7 mode 7 (single-chip mode) the cpu can access a 16-mbyte address space in advanced mode. the on-chip rom is enabled, but external addresses cannot be accessed. all i/o ports are available for use as input/output ports. 3.3.8 modes 8 and 9 modes 8 and 9 are not supported in the h8s/2319 group, and must not be set. 3.3.9 mode 10 (h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat only) this is a flash memory boot mode. for details, see section 17, rom. except for the fact that flash memory programming and erasing can be performed, operation in this mode is the same as in advanced expanded mode with on-chip rom enabled. 3.3.10 mode 11 (h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat only) this is a flash memory boot mode. for details, see section 17, rom. except for the fact that flash memory programming and erasing can be performed, operation in this mode is the same as in advanced single-chip mode.
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 80 of 1108 rej09b0089-0700 3.3.11 modes 12 and 13 modes 12 and 13 are not supported in the h8s/2319 group, and must not be set. 3.3.12 mode 14 (h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat only) this is a flash memory user program mode. for details, see section 17, rom. except for the fact that flash memory programming and erasing can be performed, operation in this mode is the same as in advanced expanded mode with on-chip rom enabled. 3.3.13 mode 15 (h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat only) this is a flash memory user program mode. for details, see section 17, rom. except for the fact that flash memory programming and erasing can be performed, operation in this mode is the same as in advanced single-chip mode. 3.4 pin functions in each operating mode the pin functions of ports 1 and a to f vary depending on the operating mode. table 3.4 shows their functions in each operating mode.
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 81 of 1108 rej09b0089-0700 table 3.4 pin functions in each mode port mode 4 mode 5 mode 2 * 4 mode 6 * 2 mode 10 * 3 mode 14 * 3 mode 1 * 5 mode 3 * 4 mode 7 * 2 mode 11 * 3 mode 15 * 3 port 1 p13 to p10 p * 1 /t/a p * 1 /t/a p * 1 /t/a p * 1 /t port a pa3 to pa0 a a p * 1 /a p port b a a p * 1 /a p port c a a p * 1 /a p port d d d d p port e p/d * 1 p * 1 /d p * 1 /d p port f pf7 p/c * 1 p/c * 1 p/c * 1 p * 1 /c pf6, pf3 p/c * 1 p/c * 1 p/c * 1 p pf5, pf4 c c c pf2 to pf0 p * 1 /c p * 1 /c p * 1 /c legend: p: i/o port t: timer i/o a: address bus output d: data bus i/o c: control signals, clock i/o notes: 1. after reset 2. not used on romless versions. 3. applies to h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat only. 4. applies to h8s/2319 f-ztat and h8s/2319c f-ztat only. 5. applies to h8s/2319c f-ztat only. 3.5 memory map in each operating mode figures 3.1 to 3.9 show memory maps for each of the operating modes. the address space is 16 mbytes. the address space is divided into eight areas.
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 82 of 1108 rej09b0089-0700 mode 2 boot mode (advanced expanded mode with on-chip rom enabled) mode 3 boot mode (advanced single-chip mode) on-chip rom on-chip rom on-chip rom/ reserved area * 2 * 4 external address space on-chip ram * 3 on-chip ram * 3 reserved area * 4 reserved area * 4 internal i/o registers external address space internal i/o registers internal i/o registers internal i/o registers external address space h'000000 h'000000 h'080000 h'ff7400 h'ff7400 h'ffdc00 h'ffdc00 h'fffbff h'ffffff h'fffe50 h'ffff07 h'ffff28 on-chip rom/ external address space * 1 h'010000 h'010000 h'07ffff h'fffc00 h'ffffff h'ffff08 h'ffff28 h'fffe50 notes: 1. external addresses when eae = 1 in bcrl; on-chip rom when eae = 0. 2. reserved area when eae = 1 in bcrl; on-chip rom when eae = 0. 3. on-chip ram is used for flash memory programming. do not clear the rame bit to 0 in syscr. 4. do not access the reserved areas. figure 3.1 (a) h8s/2319 memory map in each operating mode (f-ztat version only)
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 83 of 1108 rej09b0089-0700 m od e s 4 and 5 (advanc e d ex pand e d mod e s w i th on - ch i p ro m d i sab le d) m od e 6 (advanc e d ex pand e d mod e w i th on - ch i p ro m e nab le d) m od e 7 (advanc e d s i ng le- ch i p mod e ) e xterna l address space e xterna l address space on - ch i p rom on - ch i p ram * 3 reserved area * 4 on - ch i p ram * 3 reserved area * 4 on - ch i p ram reserved area * 4 n otes : 1 . e xterna l addresses when e a e = 1 i n bcr l ; on - ch i p rom when e a e = 0 . 2 . reserved area when e a e = 1 i n bcr l ; on - ch i p rom when e a e = 0 . 3 . e xterna l addresses can be accessed by c l ear i ng the ram e b i t i n s y scr to 0 . 4. do not access the reserved area i n addresses h'ff 7 4 00 to h'ff db ff. 5 . do not access the reserved area . i nterna l i/ o reg i sters on - ch i p rom on - ch i p rom / reserved area * 2 * 5 e xterna l address space e xterna l address space i nterna l i/ o reg i sters e xterna l address space i nterna l i/ o reg i sters e xterna l address space i nterna l i/ o reg i sters i nterna l i/ o reg i sters i nterna l i/ o reg i sters e xterna l address space h' 000000 h' 000000 h' 000000 h' 080000 h'fff c00 h'ff dc00 h'ffffff h'ff 7 4 00 h'ff 7 4 00 h'ff 7 4 00 h' 080000 h'fff b ff h'ff dc00 h'ffffff h'ffff 08 h'fffe 50 h'ffff 07 h'ffff 28 h'ffff 28 on - ch i p rom / externa l address space * 1 h'fffe 50 h' 010000 h' 010000 h' 07 ffff h'fff c00 h'ff dc00 h'ffffff h'ffff 08 h'ffff 28 h'fffe 50 figure 3.1 (b) h8s/2319 memory map in each operating mode
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 84 of 1108 rej09b0089-0700 mode 1 user boot mode (advanced single-chip mode) mode 2 boot mode (advanced expanded mode with on-chip rom enabled) mode 3 boot mode (advanced single-chip mode) on-chip rom/ reserved area * 2 * 4 on-chip rom reserved area * 4 on-chip ram * 3 reserved area * 4 reserved area * 4 on-chip ram * 3 reserved area * 4 reserved area * 4 notes: 1. external addresses when eae = 1 in bcrl; on-chip rom when eae = 0. 2. reserved area when eae = 1 in bcrl; on-chip rom when eae = 0. 3. on-chip ram is used for flash memory programming. do not clear the rame bit in syscr to 0. 4. do not access the reserved areas. on-chip rom on-chip rom/ reserved area * 2 * 4 external address space internal i/o registers external address space internal i/o registers internal i/o registers internal i/o registers external address space h'000000 h'000000 h'000000 h'100000 h'080000 h'ff7400 h'ff7400 h'0fffff h'080000 h'fffbff h'ffbc00 h'ffffff h'fffe50 h'ffff07 h'ffff28 h'ff7400 h'fffbff h'ffbc00 h'ffffff h'fffe50 h'ffff07 h'ffff28 on-chip rom on-chip rom/ external address space * 1 h'010000 h'010000 h'0fffff h'080000 h'fffc00 h'ffbc00 h'ffffff h'ffff08 h'ffff28 h'fffe50 on-chip ram * 3 reserved area * 4 internal i/o registers internal i/o registers figure 3.2 (a) h8s/2319c f-ztat memory map in each operating mode
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 85 of 1108 rej09b0089-0700 m od e s 4 and 5 (advanc e d ex pand e d mod e s w i th on - ch i p ro m d i sab le d) m od e 6 (advanc e d ex pand e d mod e w i th on - ch i p ro m e nab le d) m od e 7 (advanc e d s i ng le- ch i p mod e ) e xterna l address space on - ch i p rom on - ch i p ram * 3 reserved area * 4 on - ch i p ram * 3 reserved area * 4 reserved area * 4 on - ch i p ram reserved area * 4 reserved area * 4 n otes : 1 . e xterna l addresses when e a e = 1 i n bcr l ; on - ch i p rom when e a e = 0 . 2 . reserved area when e a e = 1 i n bcr l ; on - ch i p rom when e a e = 0 . 3 . e xterna l addresses can be accessed by c l ear i ng the ram e b i t i n s y scr to 0 . 4. do not access the reserved areas . i nterna l i/ o reg i sters on - ch i p rom on - ch i p rom / reserved area * 2 * 4 e xterna l address space e xterna l address space i nterna l i/ o reg i sters e xterna l address space i nterna l i/ o reg i sters e xterna l address space i nterna l i/ o reg i sters i nterna l i/ o reg i sters i nterna l i/ o reg i sters e xterna l address space h' 000000 h' 000000 h' 000000 h' 100000 h' 080000 h'fff c00 h'ff bc00 h'ffffff h'ff 7 4 00 h'ff 7 4 00 h'ff 7 4 00 h'fff b ff h'ff bc00 h'ffffff h'ffff 08 h'fffe 50 h'ffff 07 h'ffff 28 h'ffff 28 on - ch i p rom / externa l address space * 1 h'fffe 50 h' 010000 h' 010000 h' 0 fffff h' 080000 h'fff c00 h'ff bc00 h'ffffff h'ffff 08 h'ffff 28 h'fffe 50 figure 3.2 (b) h8s/2319c f-ztat memory map in each operating mode
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 86 of 1108 rej09b0089-0700 m od e s 4 and 5 * 1 (advanc e d ex pand e d mod e s w i th on - ch i p ro m d i sab le d) m od e 6 (advanc e d ex pand e d mod e w i th on - ch i p ro m e nab le d) m od e 7 (advanc e d s i ng le- ch i p mod e ) e xterna l address space on - ch i p rom on - ch i p ram * 4 n otes : 1 . on l y modes 4 and 5 are prov i ded i n the rom l ess vers i on (h 8s / 2312s ). 2 . e xterna l addresses when e a e = 1 i n bcr l ; on - ch i p rom when e a e = 0 . 3 . reserved area when e a e = 1 i n bcr l ; on - ch i p rom when e a e = 0 . 4. e xterna l addresses can be accessed by c l ear i ng the ram e b i t i n s y scr to 0 . 5 . do not access the reserved area . i nterna l i/ o reg i sters on - ch i p rom on - ch i p rom / reserved area * 3 * 5 e xterna l address space e xterna l address space i nterna l i/ o reg i sters e xterna l address space on - ch i p ram * 4 on - ch i p ram i nterna l i/ o reg i sters e xterna l address space i nterna l i/ o reg i sters i nterna l i/ o reg i sters i nterna l i/ o reg i sters e xterna l address space h' 000000 h' 000000 h' 000000 h' 0 4 0000 h'fff c00 h'ffffff h'ff dc00 h'ff dc00 h'ff dc00 h'fff b ff h'ffffff h'ffff 08 h'fffe 50 h'ffff 07 h'ffff 28 h'ffff 28 on - ch i p rom / externa l address space * 2 h'fffe 50 h' 010000 h' 010000 h' 03 ffff h'fff c00 h'ffffff h'ffff 08 h'ffff 28 h'fffe 50 figure 3.3 (a) h8s/2318 and h8s/2312s memory map in each operating mode
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 87 of 1108 rej09b0089-0700 mode 10 boot mode (advanced expanded mode with on-chip rom enabled) mode 11 boot mode (advanced single-chip mode) on-chip rom on-chip rom external address space on-chip ram * 3 on-chip ram * 3 on-chip rom/ reserved area * 2 * 4 internal i/o registers external address space internal i/o registers internal i/o registers internal i/o registers external address space h'000000 h'000000 h'040000 h'03ffff h'ffdc00 h'fffbff h'ffffff h'fffe50 h'ffff07 h'ffff28 on-chip rom/ external address space * 1 h'010000 h'010000 h'ffdc00 h'fffc00 h'fffe50 h'ffffff h'ffff08 h'ffff28 notes: 1. external addresses when eae = 1 in bcrl; on-chip rom when eae = 0. 2. reserved area when eae = 1 in bcrl; on-chip rom when eae = 0. 3. on-chip ram is used for flash memory programming. do not clear the rame bit in syscr to 0. 4. do not access the reserved area. figure 3.3 (b) h8s/2318 memory map in each operating mode (f-ztat version only)
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 88 of 1108 rej09b0089-0700 mode 14 user program mode (advanced expanded mode with on-chip rom enabled) mode 1 5 user program mode (advanced single-chip mode) on-chip rom on-chip rom external address space on-chip ram * 3 on-chip ram * 3 on-chip rom/ reserved area * 2 * 4 internal i/o registers external address space internal i/o registers internal i/o registers internal i/o registers external address space h'000000 h'000000 h'040000 h'03ffff h'ffdc00 h'fffbff h'ffffff h'fffe50 h'ffff07 h'ffff28 on-chip rom/ external address space * 1 h'010000 h'010000 h'ffdc00 h'fffc00 h'fffe50 h'ffffff h'ffff08 h'ffff28 notes: 1. external addresses when eae = 1 in bcrl; on-chip rom when eae = 0. 2. reserved area when eae = 1 in bcrl; on-chip rom when eae = 0. 3. on-chip ram is used for flash memory programming. do not clear the rame bit in syscr to 0. 4. do not access the reserved area. figure 3.3 (c) h8s/2318 memory map in each operating mode (f-ztat version only)
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 89 of 1108 rej09b0089-0700 modes 4 and 5 (advanced expanded modes with on-chip rom disabled) mode 6 (advanced expanded mode with on-chip rom enabled) mode 7 (advanced single-chip mode) external address space on-chip rom on-chip ram * 3 notes: 1. external addresses when eae = 1 in bcrl; on-chip rom or reserved area when eae = 0. 2. reserved area when eae = 1 in bcrl; on-chip rom eae = 0. 3. external addresses can be accessed by clearing the rame bit in syscr to 0. 4. do not access the reserved areas. internal i/o registers on-chip rom on-chip rom/ reserved area * 2 * 4 external address space external address space internal i/o registers external address space on-chip ram * 3 on-chip ram internal i/o registers external address space internal i/o registers internal i/o registers internal i/o registers external address space h'000000 h'000000 h'000000 h'040000 h'fffc00 h'ffffff h'ffdc00 h'ffdc00 h'ffdc00 h'fffbff h'ffffff h'ffff08 h'fffe50 h'ffff07 h'ffff28 h'ffff28 on-chip rom/ external address space * 1 reserved area * 4 reserved area * 4 /external address space * 1 h'fffe50 h'010000 h'010000 h'020000 h'020000 h'03ffff h'fffc00 h'ffffff h'ffff08 h'ffff28 h'fffe50 figure 3.4 (a) h8s/2317(s) memory map in each operating mode
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 90 of 1108 rej09b0089-0700 mode 10 boot mode (advanced expanded mode with on-chip rom enabled) mode 11 boot mode (advanced single-chip mode) on-chip rom on-chip rom on-chip rom/ reserved area * 2 * 4 external address space on-chip ram * 3 on-chip ram * 3 internal i/o registers external address space internal i/o registers internal i/o registers internal i/o registers external address space h'000000 h'000000 h'040000 h'ffdc00 h'ffdc00 h'fffbff h'ffffff h'fffe50 h'ffff07 h'ffff28 on-chip rom/ external address space * 1 reserved area * 4 reserved area * 4 / external address space * 1 h'010000 h'010000 h'020000 h'020000 h'03ffff h'fffc00 h'ffffff h'ffff08 h'ffff28 h'fffe50 notes: 1. external addresses when eae = 1 in bcrl; on-chip rom or reserved area when eae = 0. 2. reserved area when eae = 1 in bcrl; on-chip rom eae = 0. 3. on-chip ram is used for flash memory programming. do not clear the rame bit to 0 in syscr. 4. do not access the reserved areas. figure 3.4 (b) h8s/2317 memory map in each operating mode (f-ztat version only)
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 91 of 1108 rej09b0089-0700 mode 14 boot mode (advanced expanded mode with on-chip rom enabled) mode 1 5 boot mode (advanced single-chip mode) on-chip rom on-chip rom on-chip rom/ reserved area * 2 * 4 external address space on-chip ram * 3 on-chip ram * 3 internal i/o registers external address space internal i/o registers internal i/o registers internal i/o registers external address space h'000000 h'000000 h'040000 h'ffdc00 h'ffdc00 h'fffbff h'ffffff h'fffe50 h'ffff07 h'ffff28 on-chip rom/ external address space * 1 reserved area * 4 reserved area * 4 / external address space * 1 h'010000 h'010000 h'020000 h'020000 h'03ffff h'fffc00 h'ffffff h'ffff08 h'ffff28 h'fffe50 notes: 1. external addresses when eae = 1 in bcrl; on-chip rom or reserved area when eae = 0. 2. reserved area when eae = 1 in bcrl; on-chip rom eae = 0. 3. on-chip ram is used for flash memory programming. do not clear the rame bit to 0 in syscr. 4. do not access the reserved areas. figure 3.4 (c) h8s/2317 memory map in each operating mode (f-ztat version only)
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 92 of 1108 rej09b0089-0700 m od e s 4 and 5 (advanc e d ex pand e d mod e s w i th on - ch i p ro m d i sab le d) m od e 6 (advanc e d ex pand e d mod e w i th on - ch i p ro m e nab le d) m od e 7 (advanc e d s i ng le- ch i p mod e ) e xterna l address space on - ch i p rom on - ch i p ram * 2 n otes : 1 . e xterna l addresses when e a e = 1 i n bcr l ; reserved area when e a e = 0 . 2 . e xterna l addresses can be accessed by c l ear i ng the ram e b i t i n s y scr to 0 . 3 . do not access the reserved areas . i nterna l i/ o reg i sters on - ch i p rom reserved area * 3 e xterna l address space e xterna l address space i nterna l i/ o reg i sters e xterna l address space on - ch i p ram * 2 on - ch i p ram i nterna l i/ o reg i sters e xterna l address space i nterna l i/ o reg i sters i nterna l i/ o reg i sters i nterna l i/ o reg i sters e xterna l address space h' 000000 h' 000000 h' 000000 h' 0 4 0000 h'fff c00 h'ffffff h'ff dc00 h'ff dc00 h'ff dc00 h'fff b ff h'ffffff h'ffff 08 h'fffe 50 h'ffff 07 h'ffff 28 h'ffff 28 reserved area * 3 / externa l address space * 1 h'fffe 50 h' 010000 h' 010000 h' 03 ffff h'fff c00 h'ffffff h'ffff 08 h'ffff 28 h'fffe 50 figure 3.5 h8s/2316s memory map in each operating mode
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 93 of 1108 rej09b0089-0700 m od e s 4 and 5 (advanc e d ex pand e d mod e s w i th on - ch i p ro m d i sab le d) m od e 6 (advanc e d ex pand e d mod e w i th on - ch i p ro m e nab le d) m od e 7 (advanc e d s i ng le- ch i p mod e ) e xterna l address space e xterna l address space on - ch i p rom on - ch i p ram * 3 on - ch i p ram * 3 reserved area * 4 reserved area * 4 reserved area * 4 on - ch i p ram n otes : 1 . e xterna l addresses when e a e = 1 i n bcr l ; on - ch i p rom when e a e = 0 . 2 . reserved area when e a e = 1 i n bcr l ; on - ch i p rom when e a e = 0 . 3 . e xterna l addresses can be accessed by c l ear i ng the ram e b i t i n s y scr to 0 . 4. do not access the reserved area i n addresses h' 0 6 0000 to h' 07 ffff. 5 . do not access the reserved area . i nterna l i/ o reg i sters on - ch i p rom on - ch i p rom / reserved area * 2 * 5 e xterna l address space e xterna l address space i nterna l i/ o reg i sters e xterna l address space i nterna l i/ o reg i sters e xterna l address space i nterna l i/ o reg i sters i nterna l i/ o reg i sters i nterna l i/ o reg i sters e xterna l address space h' 000000 h' 000000 h' 000000 h' 080000 h'fff c00 h'ff dc00 h'ffffff h' 080000 h' 0 6 0000 h' 0 6 0000 h' 0 6 0000 h'fff b ff h'ff dc00 h'ffffff h'ffff 08 h'fffe 50 h'ffff 07 h'ffff 28 h'ffff 28 on - ch i p rom / externa l address space * 1 h'fffe 50 h' 010000 h' 010000 h' 07 ffff h'fff c00 h'ff dc00 h'ffffff h'ffff 08 h'ffff 28 h'fffe 50 figure 3.6 (a) h8s/2315 memory map in each operating mode
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 94 of 1108 rej09b0089-0700 mode 10 boot mode (advanced expanded mode with on-chip rom enabled) mode 11 boot mode (advanced single-chip mode) on-chip rom/ external address space * 1 external address space on-chip ram * 3 reserved area * 4 reserved area * 4 on-chip ram * 3 internal i/o registers on-chip rom on-chip rom on-chip rom/ reserved area * 2 * 5 external address space internal i/o registers external address space internal i/o registers internal i/o registers h'000000 h'000000 h'fffc00 h'ffdc00 h'ffffff h'080000 h'0 6 0000 h'0 6 0000 h'010000 h'fffbff h'ffdc00 h'ffffff h'ffff08 h'fffe50 h'ffff07 h'ffff28 h'ffff28 h'fffe50 h'010000 h'07ffff notes: 1. external addresses when eae = 1 in bcrl; on-chip rom when eae = 0. 2. reserved area when eae = 1 in bcrl; on-chip rom when eae = 0. 3. external addresses can be accessed by clearing the rame bit in syscr to 0. 4. do not access the reserved area in addresses h'0 6 0000 to h'07ffff. 5. do not access the reserved area. figure 3.6 (b) h8s/2315 memory map in ea ch operating mode (f-ztat version only)
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 95 of 1108 rej09b0089-0700 mode 14 user program mode (advanced expanded mode with on-chip rom enabled) mode 1 5 user program mode (advanced single-chip mode) on-chip rom/ external address space * 1 external address space on-chip ram * 3 reserved area * 4 reserved area * 4 on-chip ram * 3 internal i/o registers on-chip rom on-chip rom on-chip rom/ reserved area * 2 * 5 external address space internal i/o registers external address space internal i/o registers internal i/o registers h'000000 h'000000 h'fffc00 h'ffdc00 h'ffffff h'080000 h'0 6 0000 h'0 6 0000 h'010000 h'fffbff h'ffdc00 h'ffffff h'ffff08 h'fffe50 h'ffff07 h'ffff28 h'ffff28 h'fffe50 h'010000 h'07ffff notes: 1. external addresses when eae = 1 in bcrl; on-chip rom when eae = 0. 2. reserved area when eae = 1 in bcrl; on-chip rom when eae = 0. 3. external addresses can be accessed by clearing the rame bit in syscr to 0. 4. do not access the reserved area in addresses h'0 6 0000 to h'07ffff. 5. do not access the reserved area. figure 3.6 (c) h8s/2315 memory map in each operating mode (f-ztat version only)
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 96 of 1108 rej09b0089-0700 m od e s 4 and 5 (advanc e d ex pand e d mod e s w i th on - ch i p ro m d i sab le d) m od e 6 (advanc e d ex pand e d mod e w i th on - ch i p ro m e nab le d) m od e 7 (advanc e d s i ng le- ch i p mod e ) e xterna l address space e xterna l address space on - ch i p rom on - ch i p ram * 3 on - ch i p ram * 3 reserved area * 4 reserved area * 4 reserved area * 4 on - ch i p ram reserved area * 5 n otes : 1 . e xterna l addresses when e a e = 1 i n bcr l ; on - ch i p rom when e a e = 0 . 2 . reserved area when e a e = 1 i n bcr l ; on - ch i p rom when e a e = 0 . 3 . e xterna l addresses can be accessed by c l ear i ng the ram e b i t i n s y scr to 0 . 4. do not access the reserved area i n addresses h' 0 6 0000 to h' 07 ffff. 5 . do not access the reserved areas . i nterna l i/ o reg i sters on - ch i p rom on - ch i p rom / reserved area * 2 * 5 e xterna l address space e xterna l address space i nterna l i/ o reg i sters e xterna l address space i nterna l i/ o reg i sters e xterna l address space i nterna l i/ o reg i sters i nterna l i/ o reg i sters i nterna l i/ o reg i sters e xterna l address space h' 000000 h' 000000 h' 000000 h' 080000 h'fff c00 h'ffe c00 h'ffffff h' 080000 h' 0 6 0000 h' 0 6 0000 h' 0 6 0000 h'fff b ff h'ffe c00 h'ffffff h'ffff 08 h'fffe 50 h'ffff 07 h'ffff 28 h'ffff 28 on - ch i p rom / externa l address space * 1 h'fffe 50 h' 010000 h' 010000 h' 07 ffff h'ff dc00 h'ff dc00 h'ff dc00 h'fff c00 reserved area * 5 reserved area * 5 h'ffe c00 h'ffffff h'ffff 08 h'ffff 28 h'fffe 50 figure 3.7 (a) h8s/2314 memory map in each operating mode
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 97 of 1108 rej09b0089-0700 mode 10 boot mode (advanced expanded mode with on-chip rom enabled) mode 11 boot mode (advanced single-chip mode) on-chip rom/ external address space * 1 external address space on-chip ram * 3 reserved area * 4 reserved area * 4 on-chip ram * 3 reserved area * 5 internal i/o registers on-chip rom on-chip rom on-chip rom/ reserved area * 2 * 5 external address space internal i/o registers external address space internal i/o registers internal i/o registers h'000000 h'000000 h'fffc00 h'ffec00 h'ffffff h'080000 h'0 6 0000 h'0 6 0000 h'010000 h'fffbff h'ffec00 reserved area * 5 h'ffdc00 h'ffdc00 h'ffffff h'ffff08 h'fffe50 h'ffff07 h'ffff28 h'ffff28 h'fffe50 h'010000 h'07ffff notes: 1. external addresses when eae = 1 in bcrl; on-chip rom when eae = 0. 2. reserved area when eae = 1 in bcrl; on-chip rom when eae = 0. 3. on-chip ram is used for flash memory programming. do not clear the rame bit to 0 in syscr. 4. do not access the reserved area in addresses h'0 6 0000 to h'07ffff. 5. do not access the reserved areas. figure 3.7 (b) h8s/2314 memory map in ea ch operating mode (f-ztat version only)
section 3 mcu operating modes rev.7.00 feb. 14, 2007 page 98 of 1108 rej09b0089-0700 mode 14 user program mode (advanced expanded mode with on-chip rom enabled) mode 1 5 user program mode (advanced single-chip mode) on-chip rom/ external address space * 1 external address space on-chip ram * 3 reserved area * 4 reserved area * 4 on-chip ram * 3 reserved area * 5 internal i/o registers on-chip rom on-chip rom on-chip rom/ reserved area * 2 * 5 external address space internal i/o registers external address space internal i/o registers internal i/o registers h'000000 h'000000 h'fffc00 h'ffec00 reserved area * 5 h'ffdc00 h'ffffff h'080000 h'0 6 0000 h'0 6 0000 h'010000 h'fffbff h'ffec00 h'ffffff h'ffff08 h'fffe50 h'ffff07 h'ffff28 h'ffff28 h'fffe50 h'010000 h'07ffff h'ffdc00 notes: 1. external addresses when eae = 1 in bcrl; on-chip rom when eae = 0. 2. reserved area when eae = 1 in bcrl; on-chip rom when eae = 0. 3. on-chip ram is used for flash memory programming. do not clear the rame bit to 0 in syscr. 4. do not access the reserved area in addresses h'0 6 0000 to h'07ffff. 5. do not access the reserved areas. figure 3.7 (c) h8s/2314 memory map in each operating mode (f-ztat version only)
section 4 exception handling rev.7.00 feb. 14, 2007 page 99 of 1108 rej09b0089-0700 section 4 exception handling 4.1 overview 4.1.1 exception handling types and priority as table 4.1 indicates, exception handling may be caused by a reset, trap instruction, or interrupt. exception handling is prioritized as shown in ta ble 4.1. if two or more exceptions occur simultaneously, they are accepted and processed in or der of priority. trap instruction exceptions are accepted at all times in the program execution state. exception handling sources, the stack structure, and the operation of the cpu vary depending on the interrupt control mode set by the intm0 and intm1 bits of syscr. table 4.1 exception types and priority priority exception type start of exception handling high reset starts immediately after a low-to-high transition at the res pin, or when the watchdog timer overflows. trace * 1 starts when execution of the current instruction or exception handling ends, if the trace (t) bit is set to 1 interrupt starts when execution of the current instruction or exception handling ends, if an interrupt request has been issued * 2 low trap instruction (trapa) * 3 started by execution of a trap instruction (trapa) notes: 1. traces are enabled only in interrupt control mode 2. trace exception handling is not executed after execution of an rte instruction. 2. interrupt detection is not performed on completion of andc, orc, xorc, or ldc instruction execution, or on completion of reset exception handling. 3. trap instruction exception handling requests are accepted at all times in the program execution state.
section 4 exception handling rev.7.00 feb. 14, 2007 page 100 of 1108 rej09b0089-0700 4.1.2 exception handling operation exceptions originate from various sources. trap instructions and interrupts are handled as follows: 1. the program counter (pc), condition code register (ccr), and extend register (exr) are pushed onto the stack. 2. the interrupt mask bits are updated. the t bit is cleared to 0. 3. a vector address corresponding to the exception source is generated, and program execution starts from that address. for a reset exception, steps 2 and 3 above are carried out. 4.1.3 exception vector table the exception sources are classified as shown in figure 4.1. different vector addresses are assigned to different exception sources. table 4.2 lists the exception sources and their vector addresses. exception sources ? reset ? trace ? interrupts ? trap instruction external interrupts: nmi, irq7 to irq0 internal interrupts: interrupts from on-chip supporting modules figure 4.1 ex ception sources in modes 6 and 7, the on-chip rom available for use after a power-on reset is the 64-kbyte area comprising addresses h'000000 to h' 00ffff. care is required when setting vector addresses. in this case, clearing the eae bit in bcrl enables the 256-kbyte (128 kbytes/384 kbytes/512 kbytes) area * comprising addresses h'0000 00 to h'03ffff (to h'01ffff/h' 05ffff/h'07ffff) to be used. note: * the different have different amounts of on-chip rom. for details, see section 6.2.5, bus control register l (bcrl).
section 4 exception handling rev.7.00 feb. 14, 2007 page 101 of 1108 rej09b0089-0700 table 4.2 exception vector table vector address * 1 exception source vector number advanced mode reset 0 h'0000 to h'0003 reserved 1 h'0004 to h'0007 reserved for system use 2 h'0008 to h'000b 3 h'000c to h'000f 4 h'0010 to h'0013 trace 5 h'0014 to h'0017 reserved for system use 6 h'0018 to h'001b external interrupt nmi 7 h'001c to h'001f trap instruction (4 sources) 8 h'0020 to h'0023 9 h'0024 to h'0027 10 h'0028 to h'002b 11 h'002c to h'002f reserved for system use 12 h'0030 to h'0033 13 h'0034 to h'0037 14 h'0038 to h'003b 15 h'003c to h'003f external interrupt irq0 16 h'0040 to h'0043 irq1 17 h'0044 to h'0047 irq2 18 h'0048 to h'004b irq3 19 h'004c to h'004f irq4 20 h'0050 to h'0053 irq5 21 h'0054 to h'0057 irq6 22 h'0058 to h'005b irq7 23 h'005c to h'005f internal interrupt * 2 24 ? 91 h'0060 to h'0063 ? h'016c to h'016f notes: 1. lower 16 bits of the address. 2. for details of internal interrupt vectors, see section 5.3.3, interrupt exception vector table.
section 4 exception handling rev.7.00 feb. 14, 2007 page 102 of 1108 rej09b0089-0700 4.2 reset 4.2.1 overview a reset has the highest exception priority. when the res pin goes low, all processing halts and the chip enters the reset state. a reset initializes the internal state of the cpu and the registers of on-chip supporting modules. immediately after a reset, interrupt control mode 0 is set. reset exception handling begins when the res pin changes from low to high. a reset can also be caused by watchdog timer overflow. for details see section 11, watchdog timer. 4.2.2 reset sequence the chip enters the reset state when the res pin goes low. to ensure that the chip is reset, hold the res pin low for at least 20 ms at power-up. to reset the chip during operation, hold the res pin low for at least 20 states. when the res pin goes high after being held low for the necessary time, the chip starts reset exception handling as follows: 1. the internal state of the cpu and the registers of the on-chip supporting modules are initialized, the t bit is cleared to 0 in exr, and the i bit is set to 1 in exr and ccr. 2. the reset exception vector address is read and transferred to the pc, and program execution starts from the address indicated by the pc. figure 4.2 shows an example of the reset sequence.
section 4 exception handling rev.7.00 feb. 14, 2007 page 103 of 1108 rej09b0089-0700 a ddress bus vector fetch internal processing prefetch of first program instruction (1), (3) reset exception handling vector address ((1) = h'000000, (3) = h'000002) (2), (4) start address (contents of reset exception vector address) (5) start address ((5) = (2), (4)) (6) first program instruction res (1) (5) high (2) (4) (3) (6) rd hwr , lwr d 15 to d 0 * note: * 3 program wait states are inserted. ** figure 4.2 reset sequence (mode 4) 4.2.3 interrupts after reset if an interrupt is accepted after a reset but before the stack pointer (sp) is initialized, the pc and ccr will not be saved correctly, leading to a program crash. to prevent this, all interrupt requests, including nmi, are disabled immediately after a reset. since the first instruction of a program is always executed immediately after the reset state ends, make sure that this instruction initializes the stack pointer (example: mov.l #xx:32, sp). 4.2.4 state of on-chip supporting modules after reset release after reset release, mstpcr is initialized to h'3fff and all modules except the dtc enter module stop mode. consequently, on-chip supporting module registers cannot be read or written to. register reading and writing is enabled when module stop mode is exited.
section 4 exception handling rev.7.00 feb. 14, 2007 page 104 of 1108 rej09b0089-0700 4.3 traces traces are enabled in interrupt control mode 2. trace mode is not activated in interrupt control mode 0, irrespective of the state of the t bit. for details of interrupt control modes, see section 5, interrupt controller. if the t bit in exr is set to 1, trace mode is activated. in trace mode, a trace exception occurs on completion of each instruction. trace mode is canceled by clearing the t bit in exr to 0. it is not affected by interrupt masking. table 4.3 shows the state of ccr and exr after execution of trace exception handling. interrupts are accepted even within the trace exception handling routine. the t bit saved on the stack retains its value of 1, and when control is returned from the trace exception handling routine by the rte instruction, trace mode resumes. trace exception handling is not carried out after execution of the rte instruction. table 4.3 status of ccr and exr after trace exception handling ccr exr interrupt control mode i ui i2 to i0 t 0 trace exception handling cannot be used. 2 1 ? ? 0 legend: 1: set to 1 0: cleared to 0 ?: retains value prior to execution.
section 4 exception handling rev.7.00 feb. 14, 2007 page 105 of 1108 rej09b0089-0700 4.4 interrupts interrupt exception handling can be requested by nine external sources (nmi, irq7 to irq0) and 43 internal sources in the on-chip supporting modules. figure 4.3 classifies the interrupt sources and the number of interrupts of each type. the on-chip supporting modules that can request interrupts include the watchdog timer (wdt), 16-bit timer-pulse unit (tpu), 8-bit timer, serial communication interface (sci), data transfer controller (dtc), and a/d converter. each interrupt source has a separate vector address. nmi is the highest-priority interrupt. interrupts are controlled by the interrupt controller. the interrupt controller has two interrupt control modes and can assign interrupts other than nmi to eight priority/mask levels to enable multiplexed interrupt control. for details of interrupts, see section 5, interrupt controller. interrupts external interrupts internal interrupts nmi (1) irq7 to irq0 (8) wdt * (1) tpu (26) 8-bit timer (6) sci (8) dtc (1) a/d converter (1) notes: numbers in parentheses are the numbers of interrupt sources. * when the watchdog timer is used as an interval timer, it generates an interrupt request at each counter overflow. figure 4.3 interrupt sou rces and number of interrupts
section 4 exception handling rev.7.00 feb. 14, 2007 page 106 of 1108 rej09b0089-0700 4.5 trap instruction trap instruction exception handling starts when a trapa instruction is executed. trap instruction exception handling can be executed at all times in the program execution state. the trapa instruction fetches a start address from a vector table entry corresponding to a vector number from 0 to 3, as specified in the instruction code. table 4.4 shows the status of ccr and exr after execution of trap instruction exception handling. table 4.4 status of ccr and exr after trap instruction exception handling ccr exr interrupt control mode i ui i2 to i0 t 0 1 ? ? ? 2 1 ? ? 0 legend: 1: set to 1 0: cleared to 0 ?: retains value prior to execution. 4.6 stack status aft er exception handling figure 4.4 shows the stack after completion of trap instruction exception handling and interrupt exception handling. sp sp ccr pc (24 bits) ccr pc (24 bits) reserved * exr (a) interrupt control mode 0 (b) interrupt control mode 2 note: * ignored on return. figure 4.4 stack status after exception handling (advanced modes)
section 4 exception handling rev.7.00 feb. 14, 2007 page 107 of 1108 rej09b0089-0700 4.7 notes on use of the stack when accessing word data or longword data, the ch ip assumes that the lowest address bit is 0. the stack should always be accessed by word transfer instruction or longword transfer instruction, and the value of the stack pointer (sp, er7) should always be kept even. use the following instructions to save registers: push.w rn (or mov.w rn, @-sp) push.l ern (or mov.l ern, @-sp) use the following instructions to restore registers: pop.w rn (or mov.w @sp+, rn) pop.l ern (or mov.l @sp+, ern) setting sp to an odd value may lead to a malfunction. figure 4.5 shows an example of what happens when the sp value is odd. sp legend: ccr: condition code register pc: program counter r1l: general register r1l sp: stack pointer note: this diagram illustrates an example in which the interrupt control mode is 0, in advanced mode. sp sp ccr pc r1l pc h'fffefa h'fffefb h'fffefc h'fffefd mov.b r1l, @ ? er7 sp set to h'fffeff trap instruction executed data saved above sp contents of ccr lost figure 4.5 operation when sp value is odd
section 4 exception handling rev.7.00 feb. 14, 2007 page 108 of 1108 rej09b0089-0700
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 109 of 1108 rej09b0089-0700 section 5 interrupt controller 5.1 overview 5.1.1 features the chip controls interrupts by means of an interrupt controller. the interrupt controller has the following features. the available interrupt sources are external interrupts (nmi, irq7 to irq0) and internal interrupts (43 sources). ? two interrupt control modes ? either of two interrupt control modes can be set by means of the intm1 and intm0 bits in the system control register (syscr) ? priorities settable with iprs ? interrupt priority registers (iprs) are provided for setting interrupt priorities. eight priority levels can be set for each module for all interrupts except nmi ? nmi is assigned the highest priority level of 8, and can be accepted at all times ? independent vector addresses ? all interrupt sources are assigned independent vector addresses, making it unnecessary for the source to be identified in the interrupt handling routine ? nine external interrupt pins ? nmi is the highest-priority interrupt, and is accepted at all times. rising edge or falling edge can be selected for nmi ? falling edge, rising edge, or both edge detection, or level sensing, can be selected for irq7 to irq0 ? dtc control ? dtc activation is controlled by means of interrupts
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 110 of 1108 rej09b0089-0700 5.1.2 block diagram a block diagram of the interrupt controller is shown in figure 5.1. nmi input irq input internal interrupt request swdtend to tei intm1 intm0 nmieg nmi input unit irq input unit isr iscr ier ipr interrupt controller priority determination interrupt request vector number i i2 to i0 ccr exr cpu legend: iscr: irq sense control register ier: irq enable register isr: irq status register ipr: interrupt priority register syscr: system control register syscr figure 5.1 block diagram of interrupt controller
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 111 of 1108 rej09b0089-0700 5.1.3 pin configuration table 5.1 summarizes the pins of the interrupt controller. table 5.1 interrupt controller pins name symbol i/o function nonmaskable interrupt nmi input nonmaskable external interrupt; rising or falling edge can be selected external interrupt requests 7 to 0 irq7 to irq0 input maskable external interrupts; rising, falling, or both edges, or level sensing, can be selected 5.1.4 register configuration table 5.2 summarizes the registers of the interrupt controller. table 5.2 interrupt controller registers name abbreviation r/w initial value address * 1 system control register syscr r/w h'01 h'ff39 irq sense control register h iscrh r/w h'00 h'ff2c irq sense control register l iscrl r/w h'00 h'ff2d irq enable register ier r/w h'00 h'ff2e irq status register isr r/(w) * 2 h'00 h'ff2f interrupt priority register a ipra r/w h'77 h'fec4 interrupt priority register b iprb r/w h'77 h'fec5 interrupt priority register c iprc r/w h'77 h'fec6 interrupt priority register d iprd r/w h'77 h'fec7 interrupt priority register e ipre r/w h'77 h'fec8 interrupt priority register f iprf r/w h'77 h'fec9 interrupt priority register g iprg r/w h'77 h'feca interrupt priority register h iprh r/w h'77 h'fecb interrupt priority register i ipri r/w h'77 h'fecc interrupt priority register j iprj r/w h'77 h'fecd interrupt priority register k iprk r/w h'77 h'fece notes: 1. lower 16 bits of the address. 2. can only be written with 0 for flag clearing.
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 112 of 1108 rej09b0089-0700 5.2 register descriptions 5.2.1 system control register (syscr) bit : 7 6 5 4 3 2 1 0 ? ? intm1 intm0 nmieg lwrod ? rame initial value : 0 0 0 0 0 0 0 1 r/w : r/w ? r/w r/w r/w r/w r/w r/w syscr is an 8-bit readable/writable register th at selects the interrupt control mode, and the detected edge for nmi. only bits 5 to 3 are described here; for details of the other bits, see section 3, mcu operating modes. syscr is initialized to h'01 by a reset and in hardware standby mode. it is not initialized in software standby mode. bits 5 and 4?interrupt control mode 1 and 0 (intm1, intm0): these bits select one of two interrupt control modes for the interrupt controller. bit 5 intm1 bit 4 intm0 interrupt control mode description 0 0 0 interrupts are controlled by i bit (initial value) 1 ? setting prohibited 1 0 2 interrupts are controlled by bits i2 to i0, and ipr 1 ? setting prohibited bit 3?nmi edge select (nmieg): selects the input edge for the nmi pin. bit 3 nmieg description 0 interrupt request generated at falling edge of nmi input (initial value) 1 interrupt request generated at rising edge of nmi input
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 113 of 1108 rej09b0089-0700 5.2.2 interrupt priority registers a to k (ipra to iprk) bit : 7 6 5 4 3 2 1 0 ? ipr6 ipr5 ipr4 ? ipr2 ipr1 ipr0 initial value : 0 1 1 1 0 1 1 1 r/w : ? r/w r/w r/w ? r/w r/w r/w the ipr registers are eleven 8-bit readable/writable registers that set priorities (levels 7 to 0) for interrupts other than nmi. the correspondence between ipr settings and interrupt sources is shown in table 5.3. the ipr registers set a priority (levels 7 to 0) for each interrupt source other than nmi. the ipr registers are initialized to h'77 by a reset and in hardware standby mode. bits 7 and 3?reserved: read-only bits, always read as 0. table 5.3 correspondence between in terrupt sources and ipr settings bits register 6 to 4 2 to 0 ipra irq0 irq1 iprb irq2 irq3 irq4 irq5 iprc irq6 irq7 dtc iprd watchdog timer ? * ipre ? * a/d converter iprf tpu channel 0 tpu channel 1 iprg tpu channel 2 tpu channel 3 iprh tpu channel 4 tpu channel 5 ipri 8-bit timer channel 0 8-bit timer channel 1 iprj ? * sci channel 0 iprk sci channel 1 ? * note: * reserved bits.
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 114 of 1108 rej09b0089-0700 as shown in table 5.3, multiple interrupts are assigned to one ipr. setting a value in the range from h'0 to h'7 in the 3-bit groups of bits 6 to 4 and 2 to 0 sets the priority of the corresponding interrupt. the lowest priority level, level 0, is assigned by setting h'0, and the highest priority level, level 7, by setting h'7. when interrupt requests are generated, the high est-priority interrupt acco rding to the priority levels set in the ipr registers is selected. this interrupt level is then compared with the interrupt mask level set by the interrupt mask bits (i2 to i0) in the extend register (exr) in the cpu, and if the priority level of the interrupt is higher than the set mask level, an interrupt request is issued to the cpu. 5.2.3 irq enable register (ier) bit : 7 6 5 4 3 2 1 0 irq7e irq6e irq5e irq4e irq3e irq2e irq1e irq0e initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w ier is an 8-bit readable/writable register that co ntrols enabling and disabling of interrupt requests irq7 to irq0. ier is initialized to h'00 by a reset and in hardware standby mode. bits 7 to 0?irq7 to irq0 enable (irq7e to irq0e): these bits select whether irq7 to irq0 are enabled or disabled. bit n irqne description 0 irqn interrupts disabled (initial value) 1 irqn interrupts enabled (n = 7 to 0)
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 115 of 1108 rej09b0089-0700 5.2.4 irq sense control registers h and l (iscrh, iscrl) iscrh bit : 15 14 13 12 11 10 9 8 irq7scb irq7sca irq6scb irq6sca irq5scb irq5sca irq4scb irq4sca initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w iscrl bit : 7 6 5 4 3 2 1 0 irq3scb irq3sca irq2scb irq2sca irq1scb irq1sca irq0scb irq0sca initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w iscr (composed of iscrh and iscrl) is a 16-bit r eadable/writable register that selects rising edge, falling edge, or both edge detection, or level sensing, for the input at pins irq7 to irq0 . iscr is initialized to h'0000 by a reset and in hardware standby mode. bits 15 to 0?irq7 sense control a and b (irq7sca, irq7scb) to irq0 sense control a and b (irq0sca, irq0scb) bits 15 to 0 irq7scb to irq0scb irq7sca to irq0sca description 0 0 interrupt request generated at irq7 to irq0 input low level (initial value) 1 interrupt request generated at falling edge of irq7 to irq0 input 1 0 interrupt request generated at rising edge of irq7 to irq0 input 1 interrupt request generated at both falling and rising edges of irq7 to irq0 input
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 116 of 1108 rej09b0089-0700 5.2.5 irq status register (isr) bit : 7 6 5 4 3 2 1 0 irq7f irq6f irq5f irq4f irq3f irq2f irq1f irq0f initial value : 0 0 0 0 0 0 0 0 r/w : r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * note: * only 0 can be written, to clear the flag. isr is an 8-bit readable/writable register that indicates the status of irq7 to irq0 interrupt requests. isr is initialized to h'00 by a reset and in hardware standby mode. bits 7 to 0?irq7 to irq0 flags (irq7f to irq0f): these bits indicate the status of irq7 to irq0 interrupt requests. bit n irqnf description 0 [clearing conditions] (initial value) ? cleared by reading irqnf flag when irqnf = 1, then writing 0 to irqnf flag ? when interrupt exception handling is executed when low-level detection is set (irqnscb = irqnsca = 0) and irqn input is high ? when irqn interrupt exception handling is executed when falling, rising, or both- edge detection is set (irqnscb = 1 or irqnsca = 1) ? when the dtc is activated by an irqn interrupt, and the disel bit in mrb of the dtc is cleared to 0 1 [setting conditions] ? when irqn input goes low when low-level detection is set (irqnscb = irqnsca = 0) ? when a falling edge occurs in irqn input when falling edge detection is set (irqnscb = 0, irqnsca = 1) ? when a rising edge occurs in irqn input when rising edge detection is set (irqnscb = 1, irqnsca = 0) ? when a falling or rising edge occurs in irqn input when both-edge detection is set (irqnscb = irqnsca = 1) (n = 7 to 0)
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 117 of 1108 rej09b0089-0700 5.3 interrupt sources interrupt sources comprise external interrupts (nmi and irq7 to irq0) and internal interrupts (43 sources). 5.3.1 external interrupts there are nine external interrupts: nmi and irq7 to irq0. nmi and irq7 to irq0 can be used to restore the chip from software standby mode. (irq7 to irq3 can be designated for use as software standby mode clearing sources by setting the irq37s bit in sbycr to 1.) nmi interrupt: nmi is the highest-priority interrupt, and is always accepted by the cpu regardless of the status of the cpu interrupt mask bits. the nmieg bit in syscr can be used to select whether an interrupt is requested at a rising edge or a falling edge on the nmi pin. the vector number for nmi interrupt exception handling is 7. irq7 to irq0 interrupts: interrupts irq7 to irq0 are requested by an input signal at pins irq7 to irq0 . interrupts irq7 to irq0 have the following features: ? using iscr, it is possible to select whether an interrupt is generated by a low level, falling edge, rising edge, or both edges, at pins irq7 to irq0 . ? enabling or disabling of interrupt requests irq7 to irq0 can be selected with ier. ? the interrupt priority level can be set with ipr. ? the status of interrupt requests irq7 to irq0 is indicated in isr. isr flags can be cleared to 0 by software. a block diagram of interrupts irq7 to irq0 is shown in figure 5.2. irqn interrupt request irqne irqnf s r q clear signal edge/level detection circuit irqnsca, irqnscb irqn input note: n = 7 to 0 figure 5.2 block diagram of interrupts irq7 to irq0
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 118 of 1108 rej09b0089-0700 figure 5.3 shows the timing of setting irqnf. irqn input pin irqnf figure 5.3 timing of setting irqnf the vector numbers for irq7 to irq0 interrupt exception handling are 23 to 16. detection of irq7 to irq0 interrupts does not depend on whether the relevant pin has been set for input or output. therefore, when a pin is used as an external interrupt input pin, do not clear the corresponding ddr bit to 0 and use the pin as an i/o pin for another function. 5.3.2 internal interrupts there are 43 sources for internal interrupts from on-chip supporting modules. ? for each on-chip supporting module there are flags that indicate the interrupt request status, and enable bits that select enabling or disabling of these interrupts. if both of these are set to 1 for a particular interrupt source, an interrupt request is issued to the interrupt controller. ? the interrupt priority level can be set by means of ipr. ? the dtc can be activated by a tpu, sci, or other interrupt request. when the dtc is activated by an interrupt, the interrupt control mode and interrupt mask bits have no effect. 5.3.3 interrupt exception vector table table 5.4 shows interrupt exception handling sources, vector addresses, and interrupt priorities. for default priorities, the lower the vector number, the higher the priority. the dtc can also be activated by some interrupt sources. priorities among modules can be set by means of ipr. the situation when two or more modules are set to the same priority, and priorities within a module, are fixed as shown in table 5.4.
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 119 of 1108 rej09b0089-0700 table 5.4 interrupt sources, vector addresses, and interrupt priorities interrupt source origin of interrupt source vector number vector address * ipr priority dtc activation power-on reset 0 h'0000 ? high ? reserved 1 h'0004 2 h'0008 3 h'000c reserved for system use 4 h'0010 trace 5 h'0014 reserved for system use 6 h'0018 nmi external pin 7 h'001c 8 h'0020 trap instruction (4 sources) 9 h'0024 10 h'0028 11 h'002c 12 h'0030 reserved for system use 13 h'0034 14 h'0038 15 h'003c irq0 external pin 16 h'0040 ipra6 to ipra4 irq1 17 h'0044 ipra2 to ipra0 irq2 18 h'0048 iprb6 to iprb4 irq3 19 h'004c irq4 20 h'0050 iprb2 to iprb0 irq5 21 h'0054 irq6 22 h'0058 iprc6 to iprc4 irq7 23 h'005c low
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 120 of 1108 rej09b0089-0700 interrupt source origin of interrupt source vector number vector address * ipr priority dtc activation swdtend (software- activated data transfer end) dtc 24 h'0060 iprc2 to iprc0 high wovi (interval timer) watchdog timer 25 h'0064 iprd6 to iprd4 ? reserved ? 26 h'0068 iprd2 to iprd0 ? reserved ? 27 h'006c ipre6 to ipre4 ? adi (a/d conversion end) a/d 28 h'0070 ipre2 to ipre0 reserved ? 29 h'0074 ? 30 h'0078 31 h'007c tgi0a (tgr0a input capture/compare match) tpu channel 0 32 h'0080 iprf6 to iprf4 tgi0b (tgr0b input capture/compare match) 33 h'0084 tgi0c (tgr0c input capture/compare match) 34 h'0088 tgi0d (tgr0d input capture/compare match) 35 h'008c tci0v (overflow 0) 36 h'0090 ? reserved ? 37 h'0094 ? 38 h'0098 39 h'009c low
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 121 of 1108 rej09b0089-0700 interrupt source origin of interrupt source vector number vector address * ipr priority dtc activation tgi1a (tgr1a input capture/compare match) tpu channel 1 40 h'00a0 iprf2 to iprf0 high tgi1b (tgr1b input capture/compare match) 41 h'00a4 tci1v (overflow 1) 42 h'00a8 ? tci1u (underflow 1) 43 h'00ac ? tgi2a (tgr2a input capture/compare match) tpu channel 2 44 h'00b0 iprg6 to iprg4 tgi2b (tgr2b input capture/compare match) 45 h'00b4 tci2v (overflow 2) 46 h'00b8 ? tci2u (underflow 2) 47 h'00bc ? tgi3a (tgr3a input capture/compare match) tpu channel 3 48 h'00c0 iprg2 to iprg0 tgi3b (tgr3b input capture/compare match) 49 h'00c4 tgi3c (tgr3c input capture/compare match) 50 h'00c8 tgi3d (tgr3d input capture/compare match) 51 h'00cc tci3v (overflow 3) 52 h'00d0 ? reserved ? 53 h'00d4 ? 54 h'00d8 55 h'00dc low
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 122 of 1108 rej09b0089-0700 interrupt source origin of interrupt source vector number vector address * ipr priority dtc activation tgi4a (tgr4a input capture/compare match) tpu channel 4 56 h'00e0 iprh6 to iprh4 high tgi4b (tgr4b input capture/compare match) 57 h'00e4 tci4v (overflow 4) 58 h'00e8 ? tci4u (underflow 4) 59 h'00ec ? tgi5a (tgr5a input capture/compare match) tpu channel 5 60 h'00f0 iprh2 to iprh0 tgi5b (tgr5b input capture/compare match) 61 h'00f4 tci5v (overflow 5) 62 h'00f8 ? tci5u (underflow 5) 63 h'00fc ? cmia0 (compare match a) 8-bit timer channel 0 64 h'0100 ipri6 to ipri4 cmib0 (compare match b) 65 h'0104 ovi0 (overflow 0) 66 h'0108 ? reserved ? 67 h'010c ? cmia1 (compare match a) 8-bit timer channel 1 68 h'0110 ipri2 to ipri0 cmib1 (compare match b) 69 h'0114 ovi1 (overflow 1) 70 h'0118 ? reserved ? 71 h'011c low ?
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 123 of 1108 rej09b0089-0700 interrupt source origin of interrupt source vector number vector address * ipr priority dtc activation reserved ? 72 h'0120 iprj6 to iprj4 high ? 73 h'0124 74 h'0128 75 h'012c 76 h'0130 77 h'0134 78 h'0138 79 h'013c eri0 (receive error 0) sci channel 0 80 h'0140 iprj2 to iprj0 ? rxi0 (receive-data-full 0) 81 h'0144 txi0 (transmit-data- empty 0) 82 h'0148 tei0 (transmit end 0) 83 h'014c ? eri1 (receive error 1) sci channel 1 84 h'0150 iprk6 to iprk4 ? rxi1 (receive-data-full 1) 85 h'0154 txi1 (transmit-data- empty 1) 86 h'0158 tei1 (transmit end 1) 87 h'015c ? reserved ? 88 h'0160 iprk2 to iprk0 ? 89 h'0164 90 h'0168 91 h'016c low note: * lower 16 bits of the start address.
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 124 of 1108 rej09b0089-0700 5.4 interrupt operation 5.4.1 interrupt control modes and interrupt operation interrupt operations in the chip differ depending on the interrupt control mode. nmi interrupts are accepted at all times except in the reset state and the hardware standby state. in the case of irq interrupts and on-chip supporting module interrupts, an enable bit is provided for each interrupt. clearing an enable bit to 0 disabl es the corresponding interrupt request. interrupt sources for which the enable bits are set to 1 are controlled by the interrupt controller. table 5.5 shows the interrupt control modes. the interrupt controller performs interrupt contro l according to the interrupt control mode set by the intm1 and intm0 bits in syscr, the priorities set in ipr, and the masking state indicated by the i bit in the cpu?s ccr, and bits i2 to i0 in exr. table 5.5 interrupt control modes syscr interrupt control mode intm1 intm0 priority setting registers interrupt mask bits description 0 0 0 ? i interrupt mask control is performed by the i bit. ? 1 ? ? setting prohibited 2 1 0 ipr i2 to i0 8-level interrupt mask control is performed by bits i2 to i0. 8 priority levels can be set with ipr. ? 1 ? ? setting prohibited
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 125 of 1108 rej09b0089-0700 figure 5.4 shows a block diagram of the priority decision circuit. interrupt acceptance control 8-level mask control default priority determination vector numbe r interrupt control mode 2 ipr interrupt source i2 to i0 interrupt control mode 0 i figure 5.4 block diagram of interrupt control operation interrupt acceptance control: in interrupt control mode 0, interrupt acceptance is controlled by the i bit in ccr. table 5.6 shows the interrupts selected in each interrupt control mode. table 5.6 interrupts selected in each interrupt control mode (1) interrupt mask bits interrupt control mode i selected interrupts 0 0 all interrupts 1 nmi interrupts 2 * all interrupts * : don't care
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 126 of 1108 rej09b0089-0700 8-level control: in interrupt control mode 2, 8-level mask level determination is performed for the selected interrupts in interrupt acceptance co ntrol according to the in terrupt priority level (ipr). the interrupt source selected is the interrupt with the highest priority level, and whose priority level set in ipr is higher than the mask level. table 5.7 interrupts selected in each interrupt control mode (2) interrupt control mode selected interrupts 0 all interrupts 2 highest-priority-level (ipr) interrupt whose priority level is greater than the mask level (ipr > i2 to i0) default priority determination: when an interrupt is selected by 8-level control, its priority is determined and a vector number is generated. if the same value is set for ipr, acceptance of multiple interrupts is enabled, and so only the interrupt source with the highest priority according to the preset default priorities is selected and has a vector number generated. interrupt sources with a lower priority than the accepted interrupt source are held pending. table 5.8 shows operations and control signal functions in each interrupt control mode. table 5.8 operations and control signal functions in each interrupt control mode setting interrupt acceptance control 8-level control interrupt control mode intm1 intm0 i i2 to i0 ipr default priority determination t (trace) 0 0 0 im x ? ? * 2 ? 2 1 0 x ? * 1 im pr t legend: : interrupt operation control performed x : no operation (all interrupts enabled) im : used as interrupt mask bit pr : sets priority ? : not used notes: 1. set to 1 when interrupt is accepted. 2. keep the initial setting.
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 127 of 1108 rej09b0089-0700 5.4.2 interrupt control mode 0 enabling and disabling of irq interrupts and on-chip supporting module interrupts can be set by means of the i bit in the cpu?s ccr. interrupts ar e enabled when the i bit is cleared to 0, and disabled when set to 1. figure 5.5 shows a flowchart of the interrupt acceptance operation in this case. [1] if an interrupt source occurs when the corres ponding interrupt enable bit is set to 1, an interrupt request is sent to the interrupt controller. [2] the i bit is then referenced. if the i bit is clear ed to 0, the interrupt request is accepted. if the i bit is set to 1, only an nmi interrupt is accepted, and other interrupt requests are held pending. [3] interrupt requests are sent to the interrupt co ntroller, the highest-ranked interrupt according to the priority system is accepted, and other interrupt requests are held pending. [4] when an interrupt request is accepted, interru pt exception handling starts after execution of the current instruction has been completed. [5] the pc and ccr are saved to the stack area by interrupt exception handling. the pc saved on the stack shows the address of the first instruction to be executed after returning from the interrupt handling routine. [6] next, the i bit in ccr is set to 1. this masks all interrupts except nmi. [7] a vector address is generated for the accepted interrupt, and execution of the interrupt handling routine starts at the address indicated by the contents of that vector address.
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 128 of 1108 rej09b0089-0700 program e x ecut i on state i nterrupt generated ? nmi? i rq0 ? i rq 1? tei1? i = 0 ? save pc and ccr i 1 read vector address branc h to i nterrupt h and li ng rout i ne y es n o y es y es y es n o n o n o y es y es n o h o l d pend i ng figure 5.5 flowchart of procedu re up to interrupt acceptance in interrupt control mode 0
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 129 of 1108 rej09b0089-0700 5.4.3 interrupt control mode 2 eight-level masking is implemented for irq interrupts and on-chip supporting module interrupts by comparing the interrupt mask level set by bits i2 to i0 of exr in the cpu with ipr. figure 5.6 shows a flowchart of the interrupt acceptance operation in this case. [1] if an interrupt source occurs when the corres ponding interrupt enable bit is set to 1, an interrupt request is sent to the interrupt controller. [2] when interrupt requests are sent to the interrupt controller, the interrupt with the highest priority according to the interrup t priority levels set in ipr is selected, and lower-priority interrupt requests are held pending. if a number of interrupt requests with the same priority are generated at the same time, the interrupt request with the highest priority according to the priority system shown in table 5.4 is selected. [3] next, the priority of the selected interrupt request is compared with the interrupt mask level set in exr. an interrupt request with a priority no higher than the mask level set at that time is held pending, and only an interrupt request with a priority higher than the interrupt mask level is accepted. [4] when an interrupt request is accepted, interru pt exception handling starts after execution of the current instruction has been completed. [5] the pc, ccr, and exr are saved to the stack area by interrupt exception handling. the pc saved on the stack shows the address of the first instruction to be executed after returning from the interrupt handling routine. [6] the t bit in exr is cleared to 0. the interrupt mask level is rewritten with the priority level of the accepted interrupt. if the accepted interrupt is nmi, the interrupt mask level is set to h'7. [7] a vector address is generated for the accepted interrupt, and execution of the interrupt handling routine starts at the address indicated by the contents of that vector address.
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 130 of 1108 rej09b0089-0700 yes program e x ecution state interrupt generated ? n m i ? level 6 interrupt ? m ask level 5 or below ? level 7 interrupt ? m ask level 6 or below ? save pc, ccr, and exr clear t bit to 0 update mask level read vector address branc h to interrupt h andling routine hold pending level 1 interrupt ? m ask level 0 ? yes yes no yes yes yes no yes yes no no no no no no figure 5.6 flowchart of procedu re up to interrupt acceptance in interrupt control mode 2
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 131 of 1108 rej09b0089-0700 5.4.4 interrupt exception handling sequence figure 5.7 shows the interrupt exception handling sequence. the example shown is for the case where interrupt control mode 0 is set in advan ced mode, and the program area and stack area are in on-chip memory.
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 132 of 1108 rej09b0089-0700 ( 1 4) ( 1 2) ( 1 0) (8) (6) (4) (2) ( 1 ) (5) (7) (9) ( 11 )( 1 3) interrupt h andling routine instruction prefetc h internal operation vector fetc h stack instruction prefetc h internal operation interrupt acceptance interrupt level determination wait for end of instruction interrupt request signal internal address bus internal read signal internal write signal internal data bus (3) ( 1 ) (2), (4) (3) (5) (7) instruction prefetc h address (not e x ecuted. t h is is t h e contents of t h e saved pc, t h e return address.) instruction code (not e x ecuted.) instruction prefetc h address (not e x ecuted.) sp-2 sp-4 saved pc and saved ccr vector address interrupt h andling routine start address (vector address contents) interrupt h andling routine start address (( 1 3) = ( 1 0), ( 1 2)) first instruction of interrupt h andling routine (6), (8) (9), ( 11 ) ( 1 0), ( 1 2) ( 1 3) ( 1 4) figure 5.7 interrupt exception handling
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 133 of 1108 rej09b0089-0700 5.4.5 interrupt response times the chip is capable of fast word transfer instruction to on-chip memory, and the program area is provided in on-chip rom and the stack area in on-chip ram, enabling high-speed processing. table 5.9 shows interrupt response times?the interval between generation of an interrupt request and execution of the first instruction in the interrupt handling routine. the execution status symbols used in table 5.9 are explained in table 5.10. table 5.9 interrupt response times advanced mode no. item intm1 = 0 intm1 = 1 1 interrupt priority determination * 1 3 3 2 number of wait states until executing instruction ends * 2 1 to (19+2s i ) 1 to (19+2s i ) 3 pc, ccr, exr stack save 2s k 3s k 4 vector fetch 2s i 2s i 5 instruction fetch * 3 2s i 2s i 6 internal processing * 4 2 2 total (using on-chip memory) 12 to 32 13 to 33 notes: 1. two states in case of internal interrupt. 2. refers to mulxs and divxs instructions. 3. prefetch after interrupt acceptance and interrupt handling routine prefetch. 4. internal processing after interrupt acceptance and internal processing after vector fetch. table 5.10 number of states in in terrupt handling routine execution object of access external device 8-bit bus 16-bit bus symbol internal memory 2-state access 3-state access 2-state access 3-state access instruction fetch s i 1 4 6+2m 2 3+m branch address read s j stack manipulation s k legend: m: number of wait states in an external device access.
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 134 of 1108 rej09b0089-0700 5.5 usage notes 5.5.1 contention between interrupt generation and disabling when an interrupt enable bit is cleared to 0 to disable interrupts, the disabling becomes effective after execution of the instruction. in other words, when an interrupt enable bit is cleared to 0 by an instruction such as bclr or mov, if an interrupt is generated during execution of the instruction, the interrupt concerned will still be enabled on completion of the instruction, and so interrupt exception handling for that interrupt will be executed on completion of the instruction. however, if there is an interrupt request of higher priority than that interrupt, interrupt exception handling will be executed for the higher-priority interrupt, and the lower-priority interrupt will be ignored. the same also applies when an interrupt source flag is cleared. figure 5.8 shows an example in which the tgiea bit in the tpu?s tier0 register is cleared to 0. internal address bus internal write signal tgiea tgfa tgi0a interrupt signal tier0 write cycle by cpu tgi0a e x ception h andling tier0 address figure 5.8 contention between in terrupt generation and disabling
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 135 of 1108 rej09b0089-0700 the above contention will not occur if an enable b it or interrupt source flag is cleared to 0 while the interrupt is masked. 5.5.2 instructions that disable interrupts instructions that disable interrupts are ldc, andc, orc, and xorc. after any of these instructions is executed, all interrupts including nmi are disabled and the next instruction is always executed. when the i bit is set by one of these instructions, the new value becomes valid two states after execution of the instruction ends. 5.5.3 times when interrupts are disabled there are times when interrupt acceptance is disabled by the interrupt controller. the interrupt controller disables interrupt accep tance for a 3-state period after the cpu has updated the mask level with an ldc, andc, orc, or xorc instruction. 5.5.4 interrupts during execution of eepmov instruction interrupt operation differs between the eepmov.b instruction and the eepmov.w instruction. with the eepmov.b instruction, an interrupt request (including nmi) issued during the transfer is not accepted until the move is completed. with the eepmov.w instruction, if an interrupt request is issued during the transfer, interrupt exception handling starts at a break in the transfer cycle. the pc value saved on the stack in this case is the address of the next instruction. therefore, if an interrupt is generated during execution of an eepmov.w instruction, the following coding should be used. l1: eepmov.w mov.w r4,r4 bne l1
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 136 of 1108 rej09b0089-0700 5.6 dtc activation by interrupt 5.6.1 overview the dtc can be activated by an interrupt. in this case, the following options are available. 1. interrupt request to cpu 2. activation request to dtc 3. selection of a number of the above for details of interrupt requests that can be used with to activate the dtc, see section 7, data transfer controller. 5.6.2 block diagram figure 5.9 shows a block diagram of the dtc and interrupt controller. se l ect i on c i rcu i t d t c e r d t v e cr contro l l og i c determ i nat i on of pr i or i ty cpu d t c d t c act i vat i on request vector number c l ear s i gna l cpu i nterrupt request vector number se l ect s i gna l i nterrupt request i nterrupt source c l ear s i gna l i rq i nterrupt o n - c hi p support i ng modu l e c l ear s i gna l i nterrupt contro ll er i , i 2 to i 0 swd te c l ear s i gna l figure 5.9 interrupt control for dtc
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 137 of 1108 rej09b0089-0700 5.6.3 operation the interrupt controller has three main functions in dtc control. selection of interrupt source: for interrupt sources, it is possible to select dtc activation request or cpu interrupt request with the dtce bit of dtcera to dtcere in the dtc. after a dtc data transfer, the dtce bit can be cleared to 0 and an interrupt request sent to the cpu in accordance with the specification of the disel bit of mrb in the dtc. when the dtc has performed the specified number of data transfers and the transfer counter value is zero, the dtce bit is cleared to 0 and an interrupt request is sent to the cpu after the dtc data transfer. determination of priority: the dtc activation source is selected in accordance with the default priority order, and is not affected by mask or priority levels. see section 7.3.3, dtc vector table, for the respective priorities. operation order: if the same interrupt is selected as a dtc activation source and a cpu interrupt source, the dtc data transfer is performed first, followed by cpu interrupt exception handling. table 5.11 summarizes interrupt source selectio n and interrupt source clearance control according to the settings of the dtce bit of dtcera to dtcere, and the disel bit of mrb in the dtc. table 5.11 interrupt source se lection and clea ring control settings dtc interrupt source selection/clearing control dtce disel dtc cpu 0 x 1 0 x 1 legend: : the relevant interrupt is used. interrupt source clearing is performed. (the cpu should clear the source flag in the interrupt handling routine.) : the relevant interrupt is used. the interrupt source is not cleared. x : the relevant interrupt cannot be used. : don't care
section 5 interrupt controller rev.7.00 feb. 14, 2007 page 138 of 1108 rej09b0089-0700 usage note: sci and a/d converter interrupt sources ar e cleared when the dtc reads or writes to the prescribed register, and are not depe ndent upon the dta bit or disel bit.
section 6 bus controller rev.7.00 feb. 14, 2007 page 139 of 1108 rej09b0089-0700 section 6 bus controller 6.1 overview the chip has a built-in bus controller (bsc) that manages the external address space divided into eight areas. the bus specifications, such as bus width and number of access states, can be set independently for each area, enabling multip le memories to be connected easily. the bus controller also has a bus arbitration function, and controls the operation of the internal bus masters: the cpu and data transfer controller (dtc). 6.1.1 features the features of the bus controller are listed below. ? manages external address space in area units ? in advanced mode, manages the external space as 8 areas of 2 mbytes ? bus specifications can be set independently for each area ? burst rom interfaces can be set ? basic bus interface ? chip select ( cs0 to cs7 ) can be output for areas 0 to 7 ? 8-bit access or 16-bit access can be selected for each area ? 2-state access or 3-state access can be selected for each area ? program wait states can be inserted for each area ? burst rom interface ? burst rom interface can be set for area 0 ? choice of 1- or 2-state burst access ? idle cycle insertion ? an idle cycle can be inserted in case of an external read cycle between different areas ? an idle cycle can be inserted when an external read cycle is immediately followed by an external write cycle ? bus arbitration function ? includes a bus arbiter that arbitrates bus mastership among the cpu and dtc ? other features ? external bus release function
section 6 bus controller rev.7.00 feb. 14, 2007 page 140 of 1108 rej09b0089-0700 6.1.2 block diagram figure 6.1 shows a block diagram of the bus controller. area decoder bus controller abwcr astcr bcrh bcrl internal address bus cs0 to cs7 external bus control signals breq back breqo internal control signals wait controller wcrh wcrl bus mode signal bus arbiter cpu bus request signal dtc bus request signal cpu bus acknowledge signal dtc bus acknowledge signal wait internal data bus figure 6.1 block diagram of bus controller
section 6 bus controller rev.7.00 feb. 14, 2007 page 141 of 1108 rej09b0089-0700 6.1.3 pin configuration table 6.1 summarizes the pins of the bus controller. table 6.1 bus controller pins name symbol i/o function address strobe as output strobe signal indicating that address output on address bus is enabled. read rd output strobe signal indicating that external space is being read. high write hwr output strobe signal indicating that external space is to be written, and upper half (d 15 to d 8 ) of data bus is enabled. low write lwr output strobe signal indicating that external space is to be written, and lower half (d 7 to d 0 ) of data bus is enabled. chip select 0 cs0 output strobe signal indicating that area 0 is selected. chip select 1 cs1 output strobe signal indicating that area 1 is selected. chip select 2 cs2 output strobe signal indicating that area 2 is selected. chip select 3 cs3 output strobe signal indicating that area 3 is selected. chip select 4 cs4 output strobe signal indicating that area 4 is selected. chip select 5 cs5 output strobe signal indicating that area 5 is selected. chip select 6 cs6 output strobe signal indicating that area 6 is selected. chip select 7 cs7 output strobe signal indicating that area 7 is selected. wait wait input wait request signal when accessing external 3- state access space. bus request breq input request signal that releases bus to external device. bus request acknowledge back output acknowledge signal indicating that bus has been released. bus request output breqo output external bus request signal used when internal bus master accesses external space when external bus is released.
section 6 bus controller rev.7.00 feb. 14, 2007 page 142 of 1108 rej09b0089-0700 6.1.4 register configuration table 6.2 summarizes the registers of the bus controller. table 6.2 bus controller registers initial value name abbreviation r/w reset address * 1 bus width control register abwcr r/w h'ff/h'00 * 2 h'fed0 access state control register astcr r/w h'ff h'fed1 wait control register h wcrh r/w h'ff h'fed2 wait control register l wcrl r/w h'ff h'fed3 bus control register h bcrh r/w h'd0 h'fed4 bus control register l bcrl r/w h'3c h'fed5 notes: 1. lower 16 bits of the address. 2. determined by the mcu operating mode.
section 6 bus controller rev.7.00 feb. 14, 2007 page 143 of 1108 rej09b0089-0700 6.2 register descriptions 6.2.1 bus width control register (abwcr) bit : 7 6 5 4 3 2 1 0 abw7 abw6 abw5 abw4 abw3 abw2 abw1 abw0 modes 5 to 7 initial value : 1 1 1 1 1 1 1 1 r/w : r/w r/w r/w r/w r/w r/w r/w r/w mode 4 initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w abwcr is an 8-bit readable/writable register that designates each area for either 8-bit access or 16-bit access. abwcr sets the data bus width for the external memory space. the bus width for on-chip memory and internal i/o registers is fixed regardless of the settings in abwcr. after a reset and in hardware standby mode, abwcr is initialized to h'ff in modes 5 to 7, * and to h'00 in mode 4. it is not initialized in software standby mode. note: * modes 6 and 7 are not provided in the romless version. bits 7 to 0?area 7 to 0 bus width control (abw7 to abw0): these bits select whether the corresponding area is to be designated for 8-bit access or 16-bit access. bit n abwn description 0 area n is designated for 16-bit access 1 area n is designated for 8-bit access (n = 7 to 0)
section 6 bus controller rev.7.00 feb. 14, 2007 page 144 of 1108 rej09b0089-0700 6.2.2 access state control register (astcr) bit : 7 6 5 4 3 2 1 0 ast7 ast6 ast5 ast4 ast3 ast2 ast1 ast0 initial value : 1 1 1 1 1 1 1 1 r/w : r/w r/w r/w r/w r/w r/w r/w r/w astcr is an 8-bit readable/writable register that designates each area as either a 2-state access space or a 3-state access space. astcr sets the number of access states for the external memory space. the number of access states for on-chip memory and internal i/o registers is fixed regardless of the settings in astcr. astcr is initialized to h'ff by a reset and in hardware standby mode. it is not initialized in software standby mode. bits 7 to 0?area 7 to 0 access state control (ast7 to ast0): these bits select whether the corresponding area is to be designated as a 2-state access space or a 3-state access space. wait state insertion is enabled or disabled at the same time. bit n astn description 0 area n is designated for 2-state access wait state insertion in area n external space is disabled 1 area n is designated for 3-state access (initial value) wait state insertion in area n external space is enabled (n = 7 to 0)
section 6 bus controller rev.7.00 feb. 14, 2007 page 145 of 1108 rej09b0089-0700 6.2.3 wait control registers h and l (wcrh, wcrl) wcrh and wcrl are 8-bit readable/writable registers that select the number of program wait states for each area. program waits are not inserted in the case of on-chip memory or internal i/o registers. wcrh and wcrl are initialized to h'ff by a reset and in hardware standby mode. they are not initialized in software standby mode. wcrh bit : 7 6 5 4 3 2 1 0 w71 w70 w61 w60 w51 w50 w41 w40 initial value : 1 1 1 1 1 1 1 1 r/w : r/w r/w r/w r/w r/w r/w r/w r/w bits 7 and 6?area 7 wait control 1 and 0 (w71, w70): these bits select the number of program wait states when area 7 in external space is accessed while the ast7 bit in astcr is set to 1. bit 7 w71 bit 6 w70 description 0 0 program wait not inserted when external space area 7 is accessed 1 1 program wait state inserted when external space area 7 is accessed 1 0 2 program wait states inserted when external space area 7 is accessed 1 3 program wait states inserted when external space area 7 is accessed (initial value)
section 6 bus controller rev.7.00 feb. 14, 2007 page 146 of 1108 rej09b0089-0700 bits 5 and 4?area 6 wait control 1 and 0 (w61, w60): these bits select the number of program wait states when area 6 in external space is accessed while the ast6 bit in astcr is set to 1. bit 5 w61 bit 4 w60 description 0 0 program wait not inserted when external space area 6 is accessed 1 1 program wait state inserted when external space area 6 is accessed 1 0 2 program wait states inserted when external space area 6 is accessed 1 3 program wait states inserted when external space area 6 is accessed (initial value) bits 3 and 2?area 5 wait control 1 and 0 (w51, w50): these bits select the number of program wait states when area 5 in external space is accessed while the ast5 bit in astcr is set to 1. bit 3 w51 bit 2 w50 description 0 0 program wait not inserted when external space area 5 is accessed 1 1 program wait state inserted when external space area 5 is accessed 1 0 2 program wait states inserted when external space area 5 is accessed 1 3 program wait states inserted when external space area 5 is accessed (initial value) bits 1 and 0?area 4 wait control 1 and 0 (w41, w40): these bits select the number of program wait states when area 4 in external space is accessed while the ast4 bit in astcr is set to 1. bit 1 w41 bit 0 w40 description 0 0 program wait not inserted when external space area 4 is accessed 1 1 program wait state inserted when external space area 4 is accessed 1 0 2 program wait states inserted when external space area 4 is accessed 1 3 program wait states inserted when external space area 4 is accessed (initial value)
section 6 bus controller rev.7.00 feb. 14, 2007 page 147 of 1108 rej09b0089-0700 wcrl bit : 7 6 5 4 3 2 1 0 w31 w30 w21 w20 w11 w10 w01 w00 initial value : 1 1 1 1 1 1 1 1 r/w : r/w r/w r/w r/w r/w r/w r/w r/w bits 7 and 6?area 3 wait control 1 and 0 (w31, w30): these bits select the number of program wait states when area 3 in external space is accessed while the ast3 bit in astcr is set to 1. bit 7 w31 bit 6 w30 description 0 0 program wait not inserted when external space area 3 is accessed 1 1 program wait state inserted when external space area 3 is accessed 1 0 2 program wait states inserted when external space area 3 is accessed 1 3 program wait states inserted when external space area 3 is accessed (initial value) bits 5 and 4?area 2 wait control 1 and 0 (w21, w20): these bits select the number of program wait states when area 2 in external space is accessed while the ast2 bit in astcr is set to 1. bit 5 w21 bit 4 w20 description 0 0 program wait not inserted when external space area 2 is accessed 1 1 program wait state inserted when external space area 2 is accessed 1 0 2 program wait states inserted when external space area 2 is accessed 1 3 program wait states inserted when external space area 2 is accessed (initial value)
section 6 bus controller rev.7.00 feb. 14, 2007 page 148 of 1108 rej09b0089-0700 bits 3 and 2?area 1 wait control 1 and 0 (w11, w10): these bits select the number of program wait states when area 1 in external space is accessed while the ast1 bit in astcr is set to 1. bit 3 w11 bit 2 w10 description 0 0 program wait not inserted when external space area 1 is accessed 1 1 program wait state inserted when external space area 1 is accessed 1 0 2 program wait states inserted when external space area 1 is accessed 1 3 program wait states inserted when external space area 1 is accessed (initial value) bits 1 and 0?area 0 wait control 1 and 0 (w01, w00): these bits select the number of program wait states when area 0 in external space is accessed while the ast0 bit in astcr is set to 1. bit 1 w01 bit 0 w00 description 0 0 program wait not inserted when external space area 0 is accessed 1 1 program wait state inserted when external space area 0 is accessed 1 0 2 program wait states inserted when external space area 0 is accessed 1 3 program wait states inserted when external space area 0 is accessed (initial value) 6.2.4 bus control register h (bcrh) bit : 7 6 5 4 3 2 1 0 icis1 icis0 brstrm brsts1 brsts0 ? ? ? initial value : 1 1 0 1 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w bcrh is an 8-bit readable/writable register th at selects enabling or disabling of idle cycle insertion, and the memory interface for area 0. bcrh is initialized to h'd0 by a reset and in hardware standby mode. it is not initialized in software standby mode.
section 6 bus controller rev.7.00 feb. 14, 2007 page 149 of 1108 rej09b0089-0700 bit 7?idle cycle insert 1 (icis1): selects whether or not one idle cycle state is to be inserted between bus cycles when successive external read cycles are performed in different areas. bit 7 icis1 description 0 idle cycle not inserted in case of successive external read cycles in different areas 1 idle cycle inserted in case of successive external read cycles in different areas (initial value) bit 6?idle cycle insert 0 (icis0): selects whether or not one idle cycle state is to be inserted between bus cycles when successive external read and external write cycles are performed . bit 6 icis0 description 0 idle cycle not inserted in case of successive external read and external write cycles 1 idle cycle inserted in case of successive external read and external write cycles (initial value) bit 5?burst rom enable (brstrm): selects whether area 0 is used as a burst rom interface area. bit 5 brstrm description 0 area 0 is basic bus interface area (initial value) 1 area 0 is burst rom interface area bit 4?burst cycle select 1 (brsts1): selects the number of burst cycles for the burst rom interface. bit 4 brsts1 description 0 burst cycle comprises 1 state 1 burst cycle comprises 2 states (initial value)
section 6 bus controller rev.7.00 feb. 14, 2007 page 150 of 1108 rej09b0089-0700 bit 3?burst cycle select 0 (brsts0): selects the number of words that can be accessed in a burst rom interface burst access. bit 3 brsts0 description 0 max. 4 words in burst access (initial value) 1 max. 8 words in burst access bits 2 to 0?reserved: only 0 should be written to these bits. 6.2.5 bus control register l (bcrl) bit : 7 6 5 4 3 2 1 0 brle breqoe eae ? ? ? ? waite initial value : 0 0 1 1 1 1 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w bcrl is an 8-bit readable/writable register that performs selection of the external bus-released state protocol, selection of the area division unit, and enabling or disabling of wait pin input. bcrl is initialized to h'3c by a reset and in hardware standby mode. it is not initialized in software standby mode. bit 7?bus release enable (brle): enables or disables external bus release. bit 7 brle description 0 external bus release is disabled. breq , back , and breqo pins can be used as i/o ports (initial value) 1 external bus release is enabled
section 6 bus controller rev.7.00 feb. 14, 2007 page 151 of 1108 rej09b0089-0700 bit 6?breqo pin enable (breqoe): outputs a signal that requests the external bus master to drop the bus request signal ( breq ) in the external bus release state, when an internal bus master performs an external space access. bit 6 breqoe description 0 breqo output disabled. breqo pin can be used as i/o port (initial value) 1 breqo output enabled bit 5?external address enable (eae): selects whether addr esses h'010000 to h'03ffff * 2 are to be internal addresses or external addresses. description bit 5 eae h8s/2319, h8s/2319c, h8s/2318, h8s/2315, h8s/2314 h8s/2317(s) * 3 h8s/2316s 0 on-chip rom addresses h'010000 to h'01ffff are on-chip rom and addresses h'020000 to h'03ffff are reserved area * 1 reserved area * 1 1 addresses h'010000 to h'03ffff * 2 are external addresses in external expanded mode or reserved area * 1 in single-chip mode (initial value) notes: 1. do not access a reserved area. 2. h'010000 to h'03ffff in the h8s/2318. h'010000 to h'05ffff in the h8s/2315 and h8s/2314. h'010000 to h'07ffff in the h8s/2319 and h8s/2319c. 3. h8s/2317s in mask rom version. bits 4 to 2?reserved: only 1 should be written to these bits. bit 1?reserved: only 0 should be written to this bit. bit 0?wait pin enable (waite): selects enabling or disabling of wait input by the wait pin. bit 0 waite description 0 wait input by wait pin disabled. wait pin can be used as i/o port (initial value) 1 wait input by wait pin enabled
section 6 bus controller rev.7.00 feb. 14, 2007 page 152 of 1108 rej09b0089-0700 6.3 overview of bus control 6.3.1 area partitioning in advanced mode, the bus controller partitions the 16-mbyte address space into eight areas, 0 to 7, in 2-mbyte units, and performs bus control for external space in area units. figure 6.2 shows an outline of the area partitioning. chip select signals ( cs0 to cs7 ) can be output for each area. area 0 (2 m b y tes ) h'000000 h'ffffff h'1fffff h'200000 area 1 (2 m b y tes ) h'3fffff h'400000 area 2 (2 m b y tes ) h'5fffff h'600000 area 3 (2 m b y tes ) h'7fffff h'800000 area 4 (2 m b y tes ) h'9fffff h' a 00000 area 5 (2 m b y tes ) h' b fffff h' c 00000 area 6 (2 m b y tes ) h' d fffff h'e00000 area 7 (2 m b y tes ) ad v anced mode figure 6.2 overview of area partitioning
section 6 bus controller rev.7.00 feb. 14, 2007 page 153 of 1108 rej09b0089-0700 6.3.2 bus specifications the external space bus specifications consist of three elements: bus width, number of access states, and number of program wait states. the bus width and number of access states for on-chip memory and internal i/o registers are fixed, and are not affected by the bus controller. bus width: a bus width of 8 or 16 bits can be selected with abwcr. an area for which an 8-bit bus is selected functions as an 8-bit access space, and an area for which a 16-bit bus is selected functions as a16-bit access space. if all areas are designated for 8-bit access, 8-bit bus mode is set; if any area is designated for 16-bit access, 16-bit bus mode is set. when the burst rom interface is designated, 16-bit bus mode is always set. number of access states: two or three access states can be selected with astcr. an area for which 2-state access is selected functions as a 2-state access space, and an area for which 3-state access is selected functions as a 3-state access space. with the burst rom interface, the number of access states may be determined without regard to astcr. when 2-state access space is designated, wait insertion is disabled. number of program wait states: when 3-state access space is designated by astcr, the number of program wait states to be inserted automatically is selected with wcrh and wcrl. from 0 to 3 program wait states can be selected. table 6.3 shows the bus specifications for each basic bus interface area.
section 6 bus controller rev.7.00 feb. 14, 2007 page 154 of 1108 rej09b0089-0700 table 6.3 bus specifications for ea ch area (basic bus interface) wcrh, wcrl bus specifications (basic bus interface) abwcr abwn astcr astn wn1 wn0 bus width access states program wait states 0 0 ? ? 16 2 0 1 0 0 3 0 1 1 1 0 2 1 3 1 0 ? ? 8 2 0 1 0 0 3 0 1 1 1 0 2 1 3 6.3.3 memory interfaces the chip?s memory interfaces comprise a basic bus interface that allows direct connection of rom, sram, and so on; and a burst rom interface that allows direct connection of burst rom. the interface can be selected independently for each area. an area for which the basic bus interface is designated functions as normal space, and an area for which the burst rom interface is designated functions as burst rom space.
section 6 bus controller rev.7.00 feb. 14, 2007 page 155 of 1108 rej09b0089-0700 6.3.4 advanced mode the initial state of each area is basic bus interface, 3-state access space. the initial bus width is selected according to the operating mode. the bus specifications described here cover basic items only, and the sections on each memory interface (sections 6.4, basic bus interface, 6.5, burst rom interface) should be referred to for further details. area 0: area 0 includes on-chip rom * , and in rom-disabled expansion mode, all of area 0 is external space. in the rom-enabled expansion mode, the space excluding on-chip rom * is external space. note: * applies to mask rom versions only. when area 0 external space is accessed, the cs0 signal can be output. either basic bus interface or burst rom interface can be selected for area 0. areas 1 to 6: in external expansion mode, all of area 1 to 6 is external space. when area 1 to 6 external space is accessed, the cs1 to cs6 pin signals respectively can be output. only the basic bus interface can be used for areas 1 to 6. area 7: area 7 includes the on-chip ram and internal i/o registers. in external expansion mode, the space excluding the on-chip ram and internal i/o registers is external space. the on-chip ram is enabled when the rame bit in the system control register (syscr) is set to 1; when the rame bit is cleared to 0, the on-chip ram is disabled and the corresponding space becomes external space . when area 7 external space is accessed, the cs7 signal can be output. only the basic bus interface can be used for the area 7.
section 6 bus controller rev.7.00 feb. 14, 2007 page 156 of 1108 rej09b0089-0700 6.3.5 chip select signals the chip can output chip select signals ( cs0 to cs7 ) to areas 0 to 7, the signal being driven low when the corresponding external space area is accessed. figure 6.3 shows an example of csn (n = 0 to 7) output timing. enabling or disabling of the csn signal is performed by setting the data direction register (ddr), cs167 enable (cs167e), cs25 enable, css17, css36, pf1cs5s, pf0cs4s for the port corresponding to the particular csn pin. in rom-disabled expansion mode, the cs0 pin is placed in the output state after a power-on reset. pins cs1 to cs7 are placed in the input state after a power-on reset, and so the corresponding control registers should be set when outputting signals cs1 to cs7 . in the rom-enabled expansion mode, pins cs0 to cs7 are all placed in the input state after a power-on reset, and so the corresponding control registers should be set when outputting signals cs0 to cs7 . for details, see section 8, i/o ports. bus c y cle t 1 t 2 t 3 area n external address a ddress bus csn figure 6.3 csn signal output timing (n = 0 to 7)
section 6 bus controller rev.7.00 feb. 14, 2007 page 157 of 1108 rej09b0089-0700 6.4 basic bus interface 6.4.1 overview the basic bus interface enables direct connection of rom, sram, and so on. the bus specifications can be selected with abwcr, astcr, wcrh, and wcrl (see table 6.3). 6.4.2 data size and data alignment data sizes for the cpu and other internal bus masters are byte, word, and longword. the bus controller has a data alignment function, and when accessing external space, controls whether the upper data bus (d 15 to d 8 ) or lower data bus (d 7 to d 0 ) is used according to the bus specifications for the area being accessed (8-bit access space or 16-bit access space) and the data size. 8-bit access space: figure 6.4 illustrates data alignment control for the 8-bit access space. with the 8-bit access space, the upper data bus (d 15 to d 8 ) is always used for accesses. the amount of data that can be accessed at one time is one byte: a word transfer instruction is performed as two byte accesses, and a longword transfer instruction, as four byte accesses. d 15 d 8 d 7 d 0 upper data bus lower data bus b y te size word size 1 st bus c y cle 2 nd bus c y cle longword size 1 st bus c y cle 2 nd bus c y cle 3 rd bus c y cle 4th bus c y cle figure 6.4 access sizes and data a lignment control (8 -bit access space)
section 6 bus controller rev.7.00 feb. 14, 2007 page 158 of 1108 rej09b0089-0700 16-bit access space: figure 6.5 illustrates data alignment control for the 16-bit access space. with the 16-bit access space, the upper data bus (d 15 to d 8 ) and lower data bus (d 7 to d 0 ) are used for accesses. the amount of data that can be accessed at one time is one byte or one word, and a longword transfer instruction is execut ed as two word transfer instructions. in byte access, whether the upper or lower data bus is used is determined by whether the address is even or odd. the upper data bus is used for an even address, and the lower data bus for an odd address. d 15 d 8 d 7 d 0 upper data bus b y te size word size 1 st bus c y cle 2 nd bus c y cle longword size ? e v en address b y te size ? odd address lower data bus figure 6.5 access sizes and data a lignment control ( 16-bit access space)
section 6 bus controller rev.7.00 feb. 14, 2007 page 159 of 1108 rej09b0089-0700 6.4.3 valid strobes table 6.4 shows the data buses used and valid strobes for the access spaces. in a read, the rd signal is valid without discrimination between the upper and lower halves of the data bus. in a write, the hwr signal is valid for the upper half of the data bus, and the lwr signal for the lower half. table 6.4 data buses used and valid strobes area access size read/ write address valid strobe upper data bus (d 15 to d 8 ) lower data bus (d 7 to d 0 ) byte read ? rd valid invalid 8-bit access space write ? hwr hi-z byte read even rd valid invalid 16-bit access space odd invalid valid write even hwr valid hi-z odd lwr hi-z valid word read ? rd valid valid write ? hwr , lwr valid valid notes: hi-z: high impedance invalid: input state; input value is ignored.
section 6 bus controller rev.7.00 feb. 14, 2007 page 160 of 1108 rej09b0089-0700 6.4.4 basic timing 8-bit 2-state access space: figure 6.6 shows the bus timing for an 8-bit 2-state access space. when an 8-bit access space is accessed, the upper half (d 15 to d 8 ) of the data bus is used. the lwr pin is fixed high. wait states cannot be inserted. bus c y cle t 1 t 2 address bus csn as rd d 15 to d 8 valid d 7 to d 0 in v alid read hwr lwr d 15 to d 8 valid d 7 to d 0 high impedance write note: n = 0 to 7 high figure 6.6 bus timing for 8-bit 2-state access space
section 6 bus controller rev.7.00 feb. 14, 2007 page 161 of 1108 rej09b0089-0700 8-bit 3-state access space: figure 6.7 shows the bus timing for an 8-bit 3-state access space. when an 8-bit access space is accessed, the upper half (d 15 to d 8 ) of the data bus is used. the lwr pin is fixed high. wait states can be inserted. bus c y cle t 1 t 2 address bus csn as rd d 15 to d 8 valid d 7 to d 0 in v alid read hwr lwr d 15 to d 8 valid d 7 to d 0 high impedance write high note: n = 0 to 7 t 3 figure 6.7 bus timing for 8-bit 3-state access space
section 6 bus controller rev.7.00 feb. 14, 2007 page 162 of 1108 rej09b0089-0700 16-bit 2-state access space: figures 6.8 to 6.10 show bus timings for a 16-bit 2-state access space. when a 16-bit access space is accessed, the upper half (d 15 to d 8 ) of the data bus is used for the even address, and the lower half (d 7 to d 0 ) for the odd address. wait states cannot be inserted. bus c y cle t 1 t 2 address bus csn as rd d 15 to d 8 valid d 7 to d 0 in v alid read hwr lwr d 15 to d 8 valid d 7 to d 0 high impedance write high note: n = 0 to 7 figure 6.8 bus timing for 16-bit 2-state access space (1) (even address byte access)
section 6 bus controller rev.7.00 feb. 14, 2007 page 163 of 1108 rej09b0089-0700 bus c y cle t 1 t 2 address bus csn as rd d 15 to d 8 in v alid d 7 to d 0 valid read hwr lwr d 15 to d 8 high impedance d 7 to d 0 valid write note: n = 0 to 7 high figure 6.9 bus timing for 16-bit 2-stat e access space (2) (odd address byte access)
section 6 bus controller rev.7.00 feb. 14, 2007 page 164 of 1108 rej09b0089-0700 bus c y cle t 1 t 2 address bus csn as rd d 15 to d 8 valid d 7 to d 0 valid read hwr lwr d 15 to d 8 valid d 7 to d 0 valid write note: n = 0 to 7 figure 6.10 bus timing for 16-bit 2-state access space (3) (word access)
section 6 bus controller rev.7.00 feb. 14, 2007 page 165 of 1108 rej09b0089-0700 16-bit 3-state access space: figures 6.11 to 6.13 show bus timings for a 16-bit 3-state access space. when a 16-bit access space is accessed, the upper half (d 15 to d 8 ) of the data bus is used for the even address, and the lower half (d 7 to d 0 ) for the odd address. wait states can be inserted. bus c y cle t 1 t 2 address bus csn as rd d 15 to d 8 valid d 7 to d 0 in v alid read hwr lwr d 15 to d 8 valid d 7 to d 0 high impedance write high note: n = 0 to 7 t 3 figure 6.11 bus timing for 16-bit 3-state access space (1) (even address byte access)
section 6 bus controller rev.7.00 feb. 14, 2007 page 166 of 1108 rej09b0089-0700 bus c y cle t 1 t 2 address bus csn as rd d 15 to d 8 in v alid d 7 to d 0 valid read hwr lwr d 15 to d 8 high impedance d 7 to d 0 valid write high note: n = 0 to 7 t 3 figure 6.12 bus timing for 16-bit 3-stat e access space (2) (odd address byte access)
section 6 bus controller rev.7.00 feb. 14, 2007 page 167 of 1108 rej09b0089-0700 bus c y cle t 1 t 2 address bus csn as rd d 15 to d 8 valid d 7 to d 0 valid read hwr lwr d 15 to d 8 valid d 7 to d 0 valid write note: n = 0 to 7 t 3 figure 6.13 bus timing for 16-bit 3-state access space (3) (word access)
section 6 bus controller rev.7.00 feb. 14, 2007 page 168 of 1108 rej09b0089-0700 6.4.5 wait control when accessing external space, the h8s/2319 group can extend the bus cycle by inserting one or more wait states (t w ). there are two ways of inserting wait states: program wait insertion and pin wait insertion using the wait pin. program wait insertion: from 0 to 3 wait states can be inserted automatically between the t 2 state and t 3 state on an individual area basis in 3-state access space, according to the settings of wcrh and wcrl. pin wait insertion: setting the waite bit in bcrl to 1 enables wait insertion by means of the wait pin. when external space is accessed in this state, program wait insertion is first carried out according to the settings in wcrh and wcrl. then, if the wait pin is low at the falling edge of in the last t 2 or t w state, a t w state is inserted. if the wait pin is held low, t w states are inserted until it goes high. this is useful when inserting four or more t w states, or when changing the number of t w states for different external devices. the waite bit setting applies to all areas.
section 6 bus controller rev.7.00 feb. 14, 2007 page 169 of 1108 rej09b0089-0700 figure 6.14 shows an example of wait state insertion timing. b y program wait t 1 address bus as rd data bus read data read hwr , lwr write data write note: indicates the timing of wait pin sampling. wait data bus t 2 t w t w t w t 3 b y wait pin figure 6.14 example of wait state insertion timing the settings after a power-on reset are: 3-state access, 3 program wait state insertion, and wait input disabled.
section 6 bus controller rev.7.00 feb. 14, 2007 page 170 of 1108 rej09b0089-0700 6.5 burst rom interface 6.5.1 overview with the chip, external space area 0 can be designated as burst rom space, and burst rom interfacing can be performed. the burst rom space interface enables 16-bit configuration rom with burst access capability to be accessed at high speed. area 0 can be designated as burst rom space by means of the brstrm bit in bcrh. consecutive burst accesses of a maximum of 4 words or 8 words can be performed for cpu instruction fetches only. one or two states can be selected for burst access. 6.5.2 basic timing the number of states in the initial cycle (full access) of the burst rom interface is in accordance with the setting of the ast0 bit in astcr. also, when the ast0 bit is set to 1, wait state insertion is possible. one or two states can be selected for the burst cycle, according to the setting of the brsts1 bit in bcrh. wait states cannot be inserted. when area 0 is designated as burst rom space, it becomes 16-bit access space regardless of the setting of the abw0 bit in abwcr. when the brsts0 bit in bcrh is cleared to 0, burst access of up to 4 words is performed; when the brsts0 bit is set to 1, burst access of up to 8 words is performed. the basic access timing for burst rom space is shown in figures 6.15 (a) and (b). the timing shown in figure 6.15 (a) is for the case where the ast0 and brsts1 bits are both set to 1, and that in figure 6.15 (b) is for the case where both these bits are cleared to 0.
section 6 bus controller rev.7.00 feb. 14, 2007 page 171 of 1108 rej09b0089-0700 t 1 a ddress bus cs0 as data bus t 2 t 3 t 1 t 2 t 1 full access t 2 rd burst access onl y lower address changed read data read data read data figure 6.15 (a) example of burst rom access timing (when ast0 = brsts1 = 1)
section 6 bus controller rev.7.00 feb. 14, 2007 page 172 of 1108 rej09b0089-0700 t 1 a ddress bus cs0 as data bus t 2 t 1 t 1 full access rd burst access onl y lower address changed read data read data read data figure 6.15 (b) example of burst rom access timing (when ast0 = brsts1 = 0) 6.5.3 wait control as with the basic bus interface, either program wait insertion or pin wait insertion using the wait pin can be used in the initial cycle (full access) of the burst rom interface. see section 6.4.5, wait control. wait states cannot be inserted in a burst cycle.
section 6 bus controller rev.7.00 feb. 14, 2007 page 173 of 1108 rej09b0089-0700 6.6 idle cycle 6.6.1 operation when the chip accesses external space, it can insert a 1-state idle cycle (t i ) between bus cycles in the following two cases: (1) when read accesses in different areas occur consecutively, and (2) when a write cycle occurs immediately after a read cycle. by inserting an idle cycle it is possible, for example, to avoid data collisions between rom, with a long output floating time, and high- speed memory, i/o interfaces, and so on. consecutive reads in different areas: if consecutive reads in different areas occur while the icis1 bit in bcrh is set to 1, an idle cycle is inse rted at the start of the second read cycle. this is enabled in advanced mode. figure 6.16 shows an example of the operation in this case. in this example, bus cycle a is a read cycle from rom with a long output floating time, and bus cycle b is a read cycle from sram, each being located in a different area. in (a), an idle cycle is not inserted, and a collision occurs in cycle b between the read data from rom and that from sram. in (b), an idle cycle is inserted, and a data collision is prevented. t 1 a ddress bus rd bus c y c l e a data bus t 2 t 3 t 1 t 2 bus c y c l e b bus c y c l e a bus c y c l e b l ong output f l oat i ng t i me data co lli s i on (a) idle cycle not inserted (icis1 = 0) (b) idle cycle inserted (icis1 = 1 (initial value)) t 1 address bus rd data bus t 2 t 3 t i t 1 t 2 cs ( area a ) cs ( area b ) cs ( area a ) cs ( area b ) figure 6.16 example of idle cycle operation (1)
section 6 bus controller rev.7.00 feb. 14, 2007 page 174 of 1108 rej09b0089-0700 write after read: if an external write occurs after an external read while the icis0 bit in bcrh is set to 1, an idle cycle is inserted at the start of the write cycle. figure 6.17 shows an example of the operation in this case. in this example, bus cycle a is a read cycle from rom with a long output floating time, and bus cycle b is a cpu write cycle. in (a), an idle cycle is not inserted, and a collision occurs in cycle b between the read data from rom and the cpu write data. in (b), an idle cycle is inserted, and a data collision is prevented. t 1 a ddress bus rd bus c y c l e a data bus t 2 t 3 t 1 t 2 bus c y c l e b l ong output f l oat i ng t i me data co lli s i on t 1 address bus rd bus c y c l e a data bus t 2 t 3 t i t 1 bus c y c l e b t 2 h wr h wr cs ( area a ) cs ( area b ) cs ( area a ) cs ( area b ) (a) idle cycle not inserted (icis0 = 0) (b) idle cycle inserted (icis0 = 1 (initial value)) figure 6.17 example of idle cycle operation (2)
section 6 bus controller rev.7.00 feb. 14, 2007 page 175 of 1108 rej09b0089-0700 relationship between chip select ( cs ) signal and read ( rd ) signal: depending on the system?s load conditions, the rd signal may lag behind the cs signal. an example is shown in figure 6.18. in this case, with the setting for no idle cycle insertion (a), there may be a period of overlap between the bus cycle a rd signal and the bus cycle b cs signal. setting idle cycle insertion, as in (b), however, will prevent any overlap between the rd and cs signals. in the initial state after reset release, idle cycle insertion (b) is set. t 1 a ddress bus rd bus c y cle a t 2 t 3 t 1 t 2 bus c y cle b possibilit y of o v erlap between cs ( area b ) and rd t 1 address bus bus c y cle a t 2 t 3 t i t 1 bus c y cle b t 2 cs ( area a ) cs ( area b ) rd cs ( area a ) cs ( area b ) (a) i d le cyc le not i ns e rt e d ( i c i s1 = 0) (b) i d le cyc le i ns e rt e d ( i c i s1 = 1 ( i n i t i a l va l u e )) figure 6.18 relationship between chip select ( cs ) and read ( rd )
section 6 bus controller rev.7.00 feb. 14, 2007 page 176 of 1108 rej09b0089-0700 6.6.2 pin states in idle cycle table 6.5 shows the pin states in an idle cycle. table 6.5 pin states in idle cycle pins pin state a 23 to a 0 contents of next bus cycle d 15 to d 0 high impedance csn * high as high rd high hwr high lwr high note: * n = 0 to 7
section 6 bus controller rev.7.00 feb. 14, 2007 page 177 of 1108 rej09b0089-0700 6.7 bus release 6.7.1 overview the chip can release the external bus in response to a bus request from an external device. in the external bus released state, the internal bus master continues to operate as long as there is no external access. if an internal bus master wants to make an external access in the external bus released state, it can issue a bus request off-chip. 6.7.2 operation in external expansion mode, the bus can be released to an external device by setting the brle bit in bcrl to 1. driving the breq pin low issues an external bus request to the chip. when the breq pin is sampled, at the prescribed timing the back pin is driven low, and the address bus, data bus, and bus control signals are placed in the high-impedance state, establishing the external bus released state. in the external bus released state, an internal bus master can perform accesses using the internal bus. when an internal bus master wants to make an external access, it temporarily defers activation of the bus cycle, and waits for the bus request from the external bus master to be dropped. if the breqoe bit in bcrl is set to 1, when an internal bus master wants to make an external access in the external bus released state, the breqo pin is driven low and a request can be made off-chip to drop the bus request. when the breq pin is driven high, the back pin is driven high at the prescribed timing and the external bus released state is terminated. if an external bus release request and external access occur simultaneously, the order of priority is as follows: (high) external bus release > intern al bus master external access (low)
section 6 bus controller rev.7.00 feb. 14, 2007 page 178 of 1108 rej09b0089-0700 6.7.3 pin states in external bus released state table 6.6 shows the pin states in the external bus released state. table 6.6 pin states in bus released state pins pin state a 23 to a 0 high impedance d 15 to d 0 high impedance csn * high impedance as high impedance rd high impedance hwr high impedance lwr high impedance note: * n = 0 to 7
section 6 bus controller rev.7.00 feb. 14, 2007 page 179 of 1108 rej09b0089-0700 6.7.4 transition timing figure 6.19 shows the timing for transition to the bus released state. cpu c y cle external bus released state cpu c y cle address t 0 t 1 t 2 a ddress bus data bus as hwr , lwr breq back high impedance m inimum 1 state breqo * [ 1 ][ 2 ][ 3 ] [4] [ 5 ] [ 6 ] [ 1 ] [ 2 ] [ 3 ] [4] [ 5 ] [ 6 ] note: * output onl y when breqoe is set to 1 . low le v el of breq pin is sampled at rise of t 2 state. back pin is dri v en low at end of cpu read c y cle, releasing bus to external bus master. breq pin state is still sampled in external bus released state. high le v el of breq pin is sampled. back pin is dri v en high, ending bus release c y cle. breqo signal goes high 1 . 5 clocks after back signal goes high. high impedance high impedance high impedance rd high impedance figure 6.19 bus released state transition timing
section 6 bus controller rev.7.00 feb. 14, 2007 page 180 of 1108 rej09b0089-0700 6.7.5 usage note do not set mstpcr to h'ffff or h'efff, since the external bus release function will halt if a transition is made to sleep mode when either of these settings has been made. 6.8 bus arbitration 6.8.1 overview the chip has a bus arbiter that arbitrates bus master operations. there are two bus masters, the cpu and dtc, which perform read/write operations when they have possession of the bus. each bus master requests the bus by means of a bus request signal. the bus arbiter determines priorities at the prescribed timing, and permits use of the bus by means of a bus request acknowledge signal. the selected bus master then takes possession of the bus and begins its operation. 6.8.2 operation the bus arbiter detects the bus masters' bus request signals, and if the bus is requested, sends a bus request acknowledge signal to the bus master making the request. if there are bus requests from more than one bus master, the bus request acknowledge signal is sent to the one with the highest priority. when a bus master receives the bus request acknowledge signal, it takes possession of the bus until that signal is canceled. the order of priority of the bus masters is as follows: (high) dtc > cpu (low) an internal bus access by an internal bus master and external bus release, can be executed in parallel. in the event of simultaneous external bus release request and internal bus master external access request generation, the order of priority is as follows: (high) external bus release > intern al bus master external access (low)
section 6 bus controller rev.7.00 feb. 14, 2007 page 181 of 1108 rej09b0089-0700 6.8.3 bus transfer timing even if a bus request is received from a bus master with a higher priority than that of the bus master that has acquired the bus and is currently operating, the bus is not necessarily transferred immediately. there are specific times at which each bus master can relinquish the bus. cpu: the cpu is the lowest-priority bus master, and if a bus request is received from the dtc, the bus arbiter transfers the bus to the bus master th at issued the request. the timing for transfer of the bus is as follows: ? the bus is transferred at a break between bus cycles. however, if a bus cycle is executed in discrete operations, as in the case of a longword-size access, the bus is not transferred between the operations. see appendix a.5, bus states during instruction execution, for timings at which the bus is not transferred. ? if the cpu is in sleep mode, it transfers the bus immediately. dtc: the dtc sends the bus arbiter a request for the bus when an activation request is generated. the dtc can release the bus after a vector read, a regi ster information read (3 states), a single data transfer, or a register information write (3 states). it does not release the bus during a register information read (3 states), a single data transf er, or a register information write (3 states). 6.8.4 external bus release usage note external bus release can be performed on completion of an external bus cycle. the rd signal remains low until the end of the external bus cycle. therefore, when external bus release is performed, the rd signal may change from the low level to the high-impedance state. 6.9 resets and the bus controller in a reset, the chip, including the bus controller, enters the reset state at that point, and any executing bus cycle is discontinued.
section 6 bus controller rev.7.00 feb. 14, 2007 page 182 of 1108 rej09b0089-0700
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 183 of 1108 rej09b0089-0700 section 7 data transfer controller 7.1 overview the chip includes a data transfer controller (dtc). the dtc can be activated for data transfer by an interrupt or software. 7.1.1 features the features of the dtc are: ? transfer possible over any number of channels ? transfer information is stored in memory ? one activation source can trigger a number of data transfers (chain transfer) ? chain transfer execution can be set af ter data transfer (when counter = 0) ? selection of transfer modes ? normal, repeat, and block transfer modes available ? incrementing, decrementing, and fixing of source and destination addresses can be selected ? direct specification of 16-mbyte address space possible ? 24-bit transfer source and destination addresses can be specified ? transfer can be set in byte or word units ? a cpu interrupt can be requested for the interrupt that activated the dtc ? an interrupt request can be issued to the cpu after one data transfer ends ? an interrupt request can be issued to the cpu after all the specified data transfers have ended ? activation by software is possible ? module stop mode can be set ? the initial setting enables dtc registers to be accessed. dtc operation is halted by setting module stop mode
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 184 of 1108 rej09b0089-0700 7.1.2 block diagram figure 7.1 shows a block diagram of the dtc. the dtc?s register information is stored in the on-chip ram * . a 32-bit bus connects the dtc to the on-chip ram (1 kbyte), enabling 32-bit, 1- state reading and writing of dtc register information. note: * when the dtc is used, the rame bit in syscr must be set to 1. interrupt request interrupt controller dtc internal address bus dtc activation request control logic register information mra mrb cra crb dar sar cpu interrupt request on-chip ram internal data bus legend: mra, mrb: cra, crb: sar: dar: dtcera to dtcere: dtvecr: dtcera to dtcere dtvecr dtc mode registers a and b dtc transfer count registers a and b dtc source address register dtc destination address register dtc enable registers a to e dtc vector register figure 7.1 block diagram of dtc
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 185 of 1108 rej09b0089-0700 7.1.3 register configuration table 7.1 summarizes the dtc registers. table 7.1 dtc registers name abbreviation r/w initial value address * 1 dtc mode register a mra ? * 2 undefined ? * 3 dtc mode register b mrb ? * 2 undefined ? * 3 dtc source address register sar ? * 2 undefined ? * 3 dtc destination address register dar ? * 2 undefined ? * 3 dtc transfer count register a cra ? * 2 undefined ? * 3 dtc transfer count register b crb ? * 2 undefined ? * 3 dtc enable registers dtcer r/w h'00 h'ff30 to h'ff34 dtc vector register dtvecr r/w h'00 h'ff37 module stop control register mstpcr r/w h'3fff h'ff3c notes: 1. lower 16 bits of the address. 2. registers within the dtc cannot be read or written to directly. 3. register information is located in on-chip ram addresses h'f800 to h'fbff. it cannot be located in external space. when the dtc is used, do not clear the rame bit in syscr to 0.
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 186 of 1108 rej09b0089-0700 7.2 register descriptions 7.2.1 dtc mode register a (mra) bit : 7 6 5 4 3 2 1 0 sm1 sm0 dm1 dm0 md1 md0 dts sz initial value : unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined r/w : ? ? ? ? ? ? ? ? mra is an 8-bit register that controls the dtc operating mode. bits 7 and 6?source address mode 1 and 0 (sm1, sm0): these bits specify whether sar is to be incremented, decremented, or left fixed after a data transfer. bit 7 sm1 bit 6 sm0 description 0 ? sar is fixed 1 0 sar is incremented after a transfer (by +1 when sz = 0; by +2 when sz = 1) 1 sar is decremented after a transfer (by ?1 when sz = 0; by ?2 when sz = 1) bits 5 and 4?destination address mode 1 and 0 (dm1, dm0): these bits specify whether dar is to be incremented, decremented, or left fixed after a data transfer. bit 5 dm1 bit 4 dm0 description 0 ? dar is fixed 1 0 dar is incremented after a transfer (by +1 when sz = 0; by +2 when sz = 1) 1 dar is decremented after a transfer (by ?1 when sz = 0; by ?2 when sz = 1)
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 187 of 1108 rej09b0089-0700 bits 3 and 2?dtc mode (md1, md0): these bits specify the dtc transfer mode. bit 3 md1 bit 2 md0 description 0 0 normal mode 1 repeat mode 1 0 block transfer mode 1 ? bit 1?dtc transfer mode select (dts): specifies whether the source side or the destination side is set to be a repeat area or block area, in repeat mode or block transfer mode. bit 1 dts description 0 destination side is repeat area or block area 1 source side is repeat area or block area bit 0?dtc data transfer size (sz): specifies the size of data to be transferred. bit 0 sz description 0 byte-size transfer 1 word-size transfer 7.2.2 dtc mode register b (mrb) bit : 7 6 5 4 3 2 1 0 chne disel chns ? ? ? ? ? initial value : unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined r/w : ? ? ? ? ? ? ? ? mrb is an 8-bit register that controls the dtc operating mode.
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 188 of 1108 rej09b0089-0700 bit 7?dtc chain transfer enable (chne): specifies chain transfer. with chain transfer, a number of data transfers can be performed consecutively in response to a single transfer request. in data transfer with chne set to 1, determinatio n of the end of the specified number of transfers, clearing of the interrupt source flag, and clearing of dtcer are not performed. when chne is set to 1, the chain transfer condition can be selected with the chns bit. bit 7 chne description 0 end of dtc data transfer (activation waiting state) 1 dtc chain transfer (new register inform ation is read, then data is transferred) bit 6?dtc interrupt select (disel): specifies whether interrupt requests to the cpu are disabled or enabled after a data transfer. bit 6 disel description 0 after a data transfer ends, the cpu interrupt is disabled unless the transfer counter is 0 (the dtc clears the interrupt source flag of the activating interrupt to 0) 1 after a data transfer ends, the cpu interrupt is enabled (the dtc does not clear the interrupt source flag of the activating interrupt to 0) bit 5?dtc chain transfer select (chns): specifies the chain transfer condition when chne is 1. bit 7 chne bit 5 chns description 0 ? no chain transfer (dtc data transfer end, activation waiting state entered) 1 0 dtc chain transfer 1 chain transfer only when transfer counter = 0 bits 4 to 0?reserved: these bits have no effect on dtc operation in the chip and should always be written with 0.
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 189 of 1108 rej09b0089-0700 7.2.3 dtc source address register (sar) bit : 23 22 21 20 19 ? ? ? 4 3 2 1 0 ? ? ? initial value : unde- fined unde- fined unde- fined unde- fined unde- fined ? ? ? unde- fined unde- fined unde- fined unde- fined unde- fined r/w : ? ? ? ? ? ? ? ? ? ? ? ? ? sar is a 24-bit register that designates the source address of data to be transferred by the dtc. for word-size transfer, specify an even source address. 7.2.4 dtc destination address register (dar) bit : 23 22 21 20 19 ? ? ? 4 3 2 1 0 ? ? ? initial value : unde- fined unde- fined unde- fined unde- fined unde- fined ? ? ? unde- fined unde- fined unde- fined unde- fined unde- fined r/w : ? ? ? ? ? ? ? ? ? ? ? ? ? dar is a 24-bit register that designates the destination address of data to be transferred by the dtc. for word-size transfer, specify an even destination address. 7.2.5 dtc transfer count register a (cra) bit : 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value : unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined r/w : ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?????? crah ????? ??????? cral ?????? cra is a 16-bit register that designates the number of times data is to be transferred by the dtc. in normal mode, the entire cra register functions as a 16-bit transfer counter (1 to 65,536). it is decremented by 1 every time data is transferred, and transfer ends when the count reaches h'0000. in repeat mode or block transfer mode, the cra register is divided into two parts: the upper 8 bits (crah) and the lower 8 bits (cral). crah holds the number of transfers while cral functions as an 8-bit transfer counter (1 to 256). cral is decremented by 1 every time data is
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 190 of 1108 rej09b0089-0700 transferred, and the contents of crah are sent when the count reaches h'00. this operation is repeated. 7.2.6 dtc transfer count register b (crb) bit : 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value : unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined unde- fined r/w : ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? crb is a 16-bit register that designates the number of times data is to be transferred by the dtc in block transfer mode. it functions as a 16-bit transfer counter (1 to 65,536) that is decremented by 1 every time data is transferred, and transfer ends when the count reaches h'0000. 7.2.7 dtc enable registers (dtcer) bit : 7 6 5 4 3 2 1 0 dtce7 dtce6 dtce5 dtce4 dtce3 dtce2 dtce1 dtce0 initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w the dtc enable registers comprise six 8-bit r eadable/writable registers, dtcera to dtcerf, with bits corresponding to the interrupt sources th at can activate the dtc. these bits enable or disable dtc service for the corresponding interrupt sources. the dtc enable registers are initialized to h'00 by a reset and in hardware standby mode.
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 191 of 1108 rej09b0089-0700 bit n?dtc activation enable (dtcen) bit n dtcen description 0 dtc activation by this interrupt is disabled (initial value) [clearing conditions] ? when the disel bit is 1 and the data transfer has ended ? when the specified number of transfers have ended 1 dtc activation by this interrupt is enabled [holding condition] when the disel bit is 0 and the specified number of transfers have not ended (n = 7 to 0) a dtce bit can be set for each interrupt source that can activate the dtc. the correspondence between interrupt sources and dtce bits is shown in table 7.5, together with the vector numbers generated by the interrupt controller. for dtce bit setting, read/write operations must be performed using bit-manipulation instructions such as bset and bclr. for the initial setting only, however, when multiple activation sources are set at one time, it is possible to disable interrupts and write after executing a dummy read on the relevant register. 7.2.8 dtc vector register (dtvecr) bit : 7 6 5 4 3 2 1 0 swdte dtvec6 dtvec5 dtvec4 dtvec3 dtvec2 dtvec1 dtvec0 initial value : 0 0 0 0 0 0 0 0 r/w : r/(w) r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * note: * bits dtvec6 to dtvec0 can be written to when swdte = 0. dtvecr is an 8-bit readable/writable register that enables or disables dtc activation by software, and sets a vector number for the software activation interrupt. dtvecr is initialized to h'00 by a reset and in hardware standby mode.
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 192 of 1108 rej09b0089-0700 bit 7?dtc software activation enable (swdte): enables or disables dtc activation by software. bit 7 swdte description 0 dtc software activation is disabled (initial value) [clearing conditions] ? when the disel bit is 0 and the specified number of transfers have not ended ? when 0 is written after a software activation data-transfer-complete interrupt is issued to the cpu 1 dtc software activation is enabled [holding conditions] ? when the disel bit is 1 and data transfer has ended ? when the specified number of transfers have ended ? during data transfer due to software activation bits 6 to 0?dtc software activation vectors 6 to 0 (dtvec6 to dtvec0): these bits specify a vector number for dtc software activation. the vector address is expressed as h'0400 + ((vector number) << 1). <<1 indicates a one-bit left- shift. for example, when dtvec6 to dtvec0 = h'10, the vector address is h'0420. 7.2.9 module stop control register (mstpcr) mstpcrh mstpcrl bit : 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value : 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w : r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w mstpcr is a 16-bit readable/writable register that performs module stop mode control. when the mstp14 bit in mstpcr is set to 1, dtc operation stops at the end of the bus cycle and a transition is made to module stop mode. however, 1 cannot be written in the mstp14 bit while the dtc is operating. for details, see section 19.5, module stop mode. mstpcr is initialized to h'3fff by a reset and in ha rdware standby mode. it is not initialized in software standby mode.
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 193 of 1108 rej09b0089-0700 bit 14?module stop (mstp14): specifies the dtc module stop mode. bit 14 mstp14 description 0 dtc module stop mode cleared (initial value) 1 dtc module stop mode set 7.3 operation 7.3.1 overview when activated, the dtc reads register information that is already stored in memory and transfers data on the basis of that register information. after the data transfer, it writes updated register information back to memory. pre-storage of register information in memory makes it possible to transfer data over any required number of channe ls. setting the chne bit to 1 makes it possible to perform a number of transfers with a single activation. a setting can also be made to have chain transfer performed only when the transfer counter value is 0. this enables dtc re-setting to be performed by the dtc itself. figure 7.2 shows a flowchart of dtc operation, and table 7.2 summarizes the chain transfer conditions (combinations for performing the second and third transfers are omitted).
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 194 of 1108 rej09b0089-0700 start read dtc vector next transfer read register information data transfer write register information clear activation flag chne = 1? end no no no no no yes yes yes yes yes transfer counter = 0 or disel = 1? clear dtcer interrupt exception handling chns = 0? disel = 1? transfer counter = 0? figure 7.2 flowchart of dtc operation
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 195 of 1108 rej09b0089-0700 table 7.2 chain transfer conditions 1st transfer 2nd transfer chne chns disel cr chne chns disel cr dtc transfer 0 ? 0 not 0 ? ? ? ? ends at 1st transfer 0 ? 0 0 ? ? ? ? ends at 1st transfer 0 ? 1 ? ? ? ? ? interrupt request to cpu 1 0 ? ? 0 ? 0 not 0 ends at 2nd transfer 0 ? 0 0 ends at 2nd transfer 0 ? 1 ? interrupt request to cpu 1 1 0 not 0 ? ? ? ? ends at 1st transfer 1 1 ? 0 0 ? 0 not 0 ends at 2nd transfer 0 ? 0 0 ends at 2nd transfer 0 ? 1 ? interrupt request to cpu 1 1 1 not 0 ? ? ? ? ends at 1st transfer interrupt request to cpu the dtc transfer mode can be normal mode, repeat mode, or block transfer mode. the 24-bit sar designates the dtc transfer source address and the 24-bit dar designates the transfer destination address. after each transf er, sar and dar are independently incremented, decremented, or left fixed. table 7.3 outlines the functions of the dtc.
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 196 of 1108 rej09b0089-0700 table 7.3 dtc functions address registers transfer mode activation source transfer source transfer destination ? normal mode ? one transfer request transfers one byte or one word ? memory addresses are incremented or decremented by 1 or 2 ? up to 65,536 transfers possible ? repeat mode ? one transfer request transfers one byte or one word ? memory addresses are incremented or decremented by 1 or 2 ? after the specified number of transfers (1 to 256), the initial state resumes and operation continues ? block transfer mode ? one transfer request transfers a block of the specified size ? block size is from 1 to 256 bytes or words ? up to 65,536 transfers possible ? a block area can be designated at either the source or destination ? irq ? tpu tgi ? 8-bit timer cmi ? sci txi or rxi ? a/d converter adi ? software 24 bits 24 bits
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 197 of 1108 rej09b0089-0700 7.3.2 activation sources the dtc operates when activated by an interrupt or by a write to dtvecr by software. an interrupt request can be directed to the cpu or dtc, as designated by the corresponding dtcer bit. an interrupt becomes a dtc activation source when the corresponding bit is set to 1, and a cpu interrupt source when the bit is cleared to 0. at the end of a data transfer (or the last consecutive transfer in the case of chain transfer), the activation source or corresponding dtcer bit is cleared. table 7.4 shows activation source and dtcer clearance. the activation source flag, in the case of rxi0, for example, is the rdrf flag of sci0. table 7.4 activation sou rce and dtcer clearance activation source when the disel bit is 0 and the specified number of transfers have not ended when the disel bit is 1, or when the specified number of transfers have ended software activation the swdte bit is cleared to 0 ? the swdte bit remains set to 1 ? an interrupt is issued to the cpu interrupt activation ? the corresponding dtcer bit remains set to 1 ? the activation source flag is cleared to 0 ? the corresponding dtcer bit is cleared to 0 ? the activation source flag remains set to 1 ? a request is issued to the cpu for the activation source interrupt figure 7.3 shows a block diagram of activation source control. for details see section 5, interrupt controller.
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 198 of 1108 rej09b0089-0700 o n - ch i p support i ng modu l e i r q i nterrupt d tve cr se l ect i on c i rcu i t i nterrupt contro ll er c pu d t c d t c e r c l ear contro l se l ect i nterrupt re q uest source f l ag c l earance c l ear c l ear re q uest i nterrupt mas k figure 7.3 block diagram of dtc activation source control when an interrupt has been designated a dtc activation source, existing cpu mask level and interrupt controller priorities have no effect. if there is more than one activation source at the same time, the dtc operates in accordance with the default priorities. 7.3.3 dtc vector table figure 7.4 shows the correspondence between dtc vector addresses and register information. table 7.5 shows the correspondence between activation, vector addresses, and dtcer bits. when the dtc is activated by software, the vector address is obtained from: h'0400 + (dtvecr[6:0] << 1) (where << 1 indicates a 1-bit left shift). for example, if dtvecr is h'10, the vector address is h'0420. the dtc reads the start address of the register information from the vector address set for each activation source, and then reads the register information from that start address. the register information can be placed at predetermined addresses in the on-chip ram. the start address of the register information should be an integral multiple of four. the configuration of the vector address is a 2-byte unit. these two bytes specify the lower bits of the address in the on-chip ram.
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 199 of 1108 rej09b0089-0700 table 7.5 interrupt sources, dtc vector addresses, and corresponding dtces interrupt source origin of interrupt source vector number vector address dtce * priority write to dtvecr software dtvecr h'0400+ (dtvecr [6:0]<<1) ? high irq0 external pin 16 h'0420 dtcea7 irq1 17 h'0422 dtcea6 irq2 18 h'0424 dtcea5 irq3 19 h'0426 dtcea4 irq4 20 h'0428 dtcea3 irq5 21 h'042a dtcea2 irq6 22 h'042c dtcea1 irq7 23 h'042e dtcea0 adi (a/d conversion end) a/d 28 h'0438 dtceb6 tgi0a (gr0a compare match/ input capture) tpu channel 0 32 h'0440 dtceb5 tgi0b (gr0b compare match/ input capture) 33 h'0442 dtceb4 tgi0c (gr0c compare match/ input capture) 34 h'0444 dtceb3 tgi0d (gr0d compare match/ input capture) 35 h'0446 dtceb2 tgi1a (gr1a compare match/ input capture) tpu channel 1 40 h'0450 dtceb1 tgi1b (gr1b compare match/ input capture) 41 h'0452 dtceb0 tgi2a (gr2a compare match/ input capture) tpu channel 2 44 h'0458 dtcec7 tgi2b (gr2b compare match/ input capture) 45 h'045a dtcec6 low
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 200 of 1108 rej09b0089-0700 interrupt source origin of interrupt source vector number vector address dtce * priority tgi3a (gr3a compare match/ input capture) tpu channel 3 48 h'0460 dtcec5 high tgi3b (gr3b compare match/ input capture) 49 h'0462 dtcec4 tgi3c (gr3c compare match/ input capture) 50 h'0464 dtcec3 tgi3d (gr3d compare match/ input capture) 51 h'0466 dtcec2 tgi4a (gr4a compare match/ input capture) tpu channel 4 56 h'0470 dtcec1 tgi4b (gr4b compare match/ input capture) 57 h'0472 dtcec0 tgi5a (gr5a compare match/ input capture) tpu channel 5 60 h'0478 dtced5 tgi5b (gr5b compare match/ input capture) 61 h'047a dtced4 cmia0 64 h'0480 dtced3 cmib0 8-bit timer channel 0 65 h'0482 dtced2 cmia1 68 h'0488 dtced1 cmib1 8-bit timer channel 1 69 h'048a dtced0 rxi0 (receive-data-full 0) 81 h'04a2 dtcee3 txi0 (transmit-data-empty 0) sci channel 0 82 h'04a4 dtcee2 rxi1 (receive-data-full 1) sci channel 1 85 h'04aa dtcee1 txi1 (transmit-data-empty 1) 86 h'04ac dtcee0 low note: * dtce bits with no corresponding interrupt are reserved, and should be written with 0.
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 201 of 1108 rej09b0089-0700 reg i ster i nformat i on start address reg i ster i nformat i on n ext transfer d t c vector address figure 7.4 correspondence between dtc v ector address and register information 7.3.4 location of register information in address space figure 7.5 shows how the register information should be located in the address space. locate the mra, sar, mrb, dar, cra, and crb registers, in that order, from the start address of the register information (contents of the vector address). in the case of chain transfer, register information should be locat ed in consecutive areas. locate the register information in the on-chip ram (addresses: h'fff800 to h'fffbff). register information start address chain transfer register information for 2nd transfer in chain transfer mra sar mrb dar cra crb 4 bytes lower address cra crb register information mra 0123 sar mrb dar figure 7.5 location of dtc register information in address space
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 202 of 1108 rej09b0089-0700 7.3.5 normal mode in normal mode, one operation transfers one byte or one word of data. from 1 to 65,536 transfers can be specified. once the specified number of transfers have ended, a cpu interrupt can be requested. table 7.6 lists the register information in normal mode and figure 7.6 shows the memory map in normal mode. table 7.6 register information in normal mode name abbreviation function dtc source address register sar designates source address dtc destination address register dar designates destination address dtc transfer count register a cra designates transfer count dtc transfer count register b crb not used transfer sar dar figure 7.6 memory map in normal mode
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 203 of 1108 rej09b0089-0700 7.3.6 repeat mode in repeat mode, one operation transfers one byte or one word of data. from 1 to 256 transfers can be specified. once th e specified number of transfers have ended, the initial state of the transfer counter and the address register specified as the repeat area is restored, and transfer is repeated. in repeat mode the transfer counter value does not reach h'00, and therefore cpu interrupts cannot be requested when disel = 0. table 7.7 lists the register information in repeat mode and figure 7.7 shows the memory map in repeat mode. table 7.7 register information in repeat mode name abbreviation function dtc source address register sar designates source address dtc destination address register dar designates destination address dtc transfer count register ah crah holds number of transfers dtc transfer count register al cral transfer counter dtc transfer count register b crb not used transfer sar or dar dar o r sar repeat area figure 7.7 memory map in repeat mode
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 204 of 1108 rej09b0089-0700 7.3.7 block transfer mode in block transfer mode, one operation transfers one block of data. either the transfer source or the transfer destination is designated as a block area. the block size is 1 to 256. when the transfer of one block ends, the initial state of the block size counter and the address register specified as the block area is restored. the other address register is then incremented, decremented, or left fixed. from 1 to 65,536 transfers can be specified. once the specified number of transfers have ended, a cpu interrupt is requested. table 7.8 lists the register information in block transfer mode and figure 7.8 shows the memory map in block transfer mode. table 7.8 register information in block transfer mode name abbreviation function dtc source address register sar de signates transfer source address dtc destination address register dar designates destination address dtc transfer count register ah crah holds block size dtc transfer count register al cral block size counter dtc transfer count register b crb transfer counter
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 205 of 1108 rej09b0089-0700 transfer sar or dar dar o r sar bloc k area first bloc k nth bloc k figure 7.8 memory map in block transfer mode
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 206 of 1108 rej09b0089-0700 7.3.8 chain transfer setting the chne bit to 1 enables a number of data transfers to be performed consecutively in response to a single transfer request. it is also possible, by setting both the chne bit and chns bit to 1, to specify execution of chain transfer only when the transfer counter value is 0. sar, dar, cra, crb, mra, and mrb, which define data transfers, can be set independently. figure 7.9 shows the memory map for chain transfer. source source destination destination dtc vector address register information start address register information chne = 1 register information chne = 0 figure 7.9 chain transfer memory map in the case of transfer with chne set to 1, an interrupt request to the cpu is not generated at the end of the specified number of transfers or by setting of the disel bit to 1, and the interrupt source flag for the activation source is not affected.
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 207 of 1108 rej09b0089-0700 7.3.9 operation timing figures 7.10 to 7.12 show examples of dtc operation timing. dtc activation re q uest dtc re q uest a ddress v ector read transfer information read transfer information write data transfer read write figure 7.10 dtc operation timing (example in normal mode or repeat mode) read write read write data transfer transfer information write transfer information read v ector read dtc activation re q uest dtc re q uest a ddress figure 7.11 dtc operation timing (example of block transfer mode, with block size of 2)
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 208 of 1108 rej09b0089-0700 read write read write a ddress dtc activation re q uest dtc re q uest data transfer data transfer transfer information write transfer information write transfer information read transfer information read v ector read figure 7.12 dtc operation timing (example of chain transfer) 7.3.10 number of dtc execution states table 7.9 lists execution phases for a single dtc data transfer, and table 7.10 shows the number of states required for each execution phase. table 7.9 dtc execution phases mode vector read i register information read/write j data read k data write l internal operations m normal 1 6 1 1 3 repeat 1 6 1 1 3 block transfer 1 6 n n 3 n: block size (initial setting of crah and cral)
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 209 of 1108 rej09b0089-0700 table 7.10 number of states required for each execution phase access to: on- chip ram on- chip rom internal i/o registers external devices bus width 32 16 8 16 8 8 16 16 access states 1 1 2 2 2 3 2 3 vector read s i ? 1 ? ? 4 6+2m 2 3+m execution phase register information read/write s j 1 ? ? ? ? ? ? ? byte data read s k 1 1 2 2 2 3+m 2 3+m word data read s k 1 1 4 2 4 6+2m 2 3+m byte data write s l 1 1 2 2 2 3+m 2 3+m word data write s l 1 1 4 2 4 6+2m 2 3+m internal operation s m 1 1 1 1 1 1 1 1 the number of execution states is calculated from the formula below. note that means the sum of all transfers activated by one activation event (the number in which the chne bit is set to 1, plus 1). number of execution states = i s i + (j s j + k s k + l s l ) + m s m for example, when the dtc vector address table is located in on-chip rom, normal mode is set, and data is transferred from the on-chip rom to an internal i/o register, the time required for the dtc operation is 13 states. the time from activation to the end of the data write is 10 states.
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 210 of 1108 rej09b0089-0700 7.3.11 procedures for using dtc activation by interrupt: the procedure for using the dtc with interrupt activation is as follows: [1] set the mra, mrb, sar, dar, cra, and crb register information in the on-chip ram. [2] set the start address of the register information in the dtc vector address. [3] set the corresponding bit in dtcer to 1. [4] set the enable bits for the interrupt sources to be used as the activation sources to 1. the dtc is activated when an interrupt used as an activation source is generated. [5] after the end of one data transfer, or after the specified number of data transfers have ended, the dtce bit is cleared to 0 and a cpu interrupt is requested. if the dtc is to continue transferring data, set the dtce bit to 1. activation by software: the procedure for using the dtc with software activation is as follows: [1] set the mra, mrb, sar, dar, cra, and crb register information in the on-chip ram. [2] set the start address of the register information in the dtc vector address. [3] check that the swdte bit is 0. [4] write 1 to the swdte bit and the vector number to dtvecr. [5] check the vector number written to dtvecr. [6] after the end of one data transfer, if the disel bit is 0 and a cpu interrupt is not requested, the swdte bit is cleared to 0. if the dtc is to continue transferring data, set the swdte bit to 1. when the disel bit is 1, or after the speci fied number of data transfers have ended, the swdte bit is held at 1 and a cpu interrupt is requested.
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 211 of 1108 rej09b0089-0700 7.3.12 examples of use of the dtc normal mode: an example is shown in which the dtc is used to receive 128 bytes of data via the sci. [1] set mra to fixed source address (sm1 = sm0 = 0), incrementing destination address (dm1 = 1, dm0 = 0), normal mode (md1 = md0 = 0), and byte size (sz = 0). the dts bit can have any value. set mrb for one data transfer by one interrupt (chne = 0, disel = 0). set the sci rdr address in sar, the start address of the ram area where the data will be received in dar, and 128 (h'0080) in cra. crb can be set to any value. [2] set the start address of the register information at the dtc vector address. [3] set the corresponding bit in dtcer to 1. [4] set the sci to the appropriate receive mode. set the rie bit in scr to 1 to enable the reception data full (rxi) interrupt. since the generation of a receive error during the sci receive operation will disable subsequent r eception, the cpu should be enabled to accept receive error interrupts. [5] each time reception of one byte of data ends on the sci, the rdrf flag in ssr is set to 1, an rxi interrupt is generated, and the dtc is activated. the receive data is transferred from rdr to ram by the dtc. dar is incremented and cra is decremented. the rdrf flag is automatically cleared to 0. [6] when cra becomes 0 after the 128 data transfers have ended, the rdrf flag is held at 1, the dtce bit is cleared to 0, and an rxi interrupt request is sent to the cpu. the interrupt handling routine should perform wrap-up processing.
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 212 of 1108 rej09b0089-0700 chain transfer when counter = 0: by executing a second data transfer, and performing re- setting of the first data transfer, only when the counter value is 0, it is possible to perform 256 or more repeat transfers. an example is shown in which a 128-kbyte input buffer is configured. the input buffer is assumed to have been set to start at lower address h'0000. figure 7.13 shows the memory map. [1] for the first transfer, set the normal mode for input data. set fixed transfer source address (g/a, etc.), cra = h'0000 (64k times), and chne = 1, chns = 1, and disel = 0. [2] prepare the upper 8-bit addresses of the start addresses for each of the 64k transfer start addresses for the first data transfer in a separate area (in rom, etc.). for example, if the input buffer comprises h'200000 to h'21ffff, prepare h'21 and h'20. [3] for the second transfer, set re peat mode (with the source side as the repeat area) for re-setting the transfer destination address for the first data transfer. use the upper 8 bits of dar in the first register information area as the transfer de stination. set chne = disel = 0. if the above input buffer is specified as h'200000 to h'21ffff, set the transfer counter to 2. [4] execute the first data transfer 64k times by means of interrupts. when the transfer counter for the first data transfer reaches 0, the second data transfer is started. set the upper 8 bits of the transfer source address for the first data transf er to h'21. the lower 16 bits of the transfer destination address of the first data transfer and the transfer counter are h'0000. [5] next, execute the first data transfer the 64k ti mes specified for the first data transfer by means of interrupts. when the transfer counter for the first data transfer reaches 0, the second data transfer is started. set the upper 8 bits of the tr ansfer source address for the first data transfer to h'20. the lower 16 bits of the transfer destination address of the first data transfer and the transfer counter are h'0000. [6] steps [4] and [5] are repeated endlessly. as repeat mode is specified for the second data transfer, an interrupt request is not sent to the cpu.
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 213 of 1108 rej09b0089-0700 first data transfer register information second data transfer register information chain transfer (counter = 0) u pper 8 bits of dar input buffer input circuit figure 7.13 chain transfer when counter = 0
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 214 of 1108 rej09b0089-0700 software activation: an example is shown in which the dtc is used to transfer a block of 128 bytes of data by means of software activation. the transfer source address is h'1000 and the destination address is h'2000. the vector number is h'60, so the vector address is h'04c0. [1] set mra to incrementing source address (sm1 = 1, sm0 = 0), incrementing destination address (dm1 = 1, dm0 = 0), block transfer mode (md1 = 1, md0 = 0), and byte size (sz = 0). the dts bit can have any value. set mrb for one block transfer by one interrupt (chne = 0). set the transfer source address (h'1000) in sar, the destination address (h'2000) in dar, and 128 (h'8080) in cra. set 1 (h'0001) in crb. [2] set the start address of the register info rmation at the dtc vector address (h'04c0). [3] check that the swdte bit in dtvecr is 0. chec k that there is currently no transfer activated by software. [4] write 1 to the swdte bit and the vector number (h'60) to dtvecr. the write data is h'e0. [5] read dtvecr again and check that it is set to the vector number (h'60). if it is not, this indicates that the write failed. this is presum ably because an interrupt occurred between steps 3 and 4 and led to a different software activation. to activate this transfer, go back to step 3. [6] if the write was successful, the dtc is activated and a block of 128 bytes of data is transferred. [7] after the transfer, an swdtend interrupt occurs. the interrupt handling routine should clear the swdte bit to 0 and perform other wrap-up processing.
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 215 of 1108 rej09b0089-0700 7.4 interrupts an interrupt request is issued to the cpu when the dtc finishes the specified number of data transfers, or a data transfer for which the disel bit was set to 1. in the case of interrupt activation, the interrupt set as the activation source is generated. these interrupts to the cpu are subject to cpu mask level and interrupt controller priority level control. in the case of activation by software, a software activated data transfer end interrupt (swdtend) is generated. when the disel bit is 1 and one data transfer has ended, or the specified number of transfers have ended, after data transfer ends, the swdte bit is held at 1 and an swdtend interrupt is generated. the interrupt handling routine should clear the swdte bit to 0. when the dtc is activated by software, an swdtend interrupt is not generated during a data transfer wait or during data transfer even if the swdte bit is set to 1. 7.5 usage notes module stop: when the mstp14 bit in mstpcr is set to 1, the dtc clock stops, and the dtc enters the module stop state. however, 1 cannot be written to the mstp14 bit while the dtc is operating. on-chip ram: the mra, mrb, sar, dar, cra, and crb registers are all located in on-chip ram. when the dtc is used, the rame bit in syscr must not be cleared to 0. dtce bit setting: for dtce bit setting, read/write operations must be performed using bit- manipulation instructions such as bset and bclr. for the initial setting only, however, when multiple activation sources are set at one time, it is possible to disable interrupts and write after executing a dummy read on the relevant register. chain transfer: when chain transfer is used, clearin g of the activation source or dtcer is performed when the last of the chain of data transfers is executed. sci and a/d converter interrupt/activation sources, on the other hand, ar e cleared when the dtc reads or writes to the prescribed register. therefore, when the dtc is activated by an interru pt or activation source, if a read/write of the relevant register is not included in the last chained data transfer, the interrupt or activation source will be retained.
section 7 data transfer controller rev.7.00 feb. 14, 2007 page 216 of 1108 rej09b0089-0700
section 8 i/o ports rev.7.00 feb. 14, 2007 page 217 of 1108 rej09b0089-0700 section 8 i/o ports 8.1 overview the h8s/2319 group has 10 i/o ports (ports 1 to 3, and a to g), and one input-only port (port 4). table 8.1 summarizes the port functions. the pins of each port also have other functions. each port includes a data direction register (ddr) that controls input/output (not provided for the input-only ports), a data register (dr) that stores output data, and a port register (port) used to read the pin states. ports a to e have a built-in mos pull-up function, and in addition to dr and ddr, have a mos input pull-up control register (pcr) to control the on/off state of mos input pull-up. port 3 and port a include an open drain control register (odr) that controls the on/off state of the output buffer pmos. ports 1, a to f can drive a single ttl load and 50-pf capacitive load, and ports 2, 3, and g can drive a single ttl load and 30-pf capacitive load. ports 1, 2, and ports 34, 35 (only when used as irq inputs), ports f0 to f3 (only when used as irq inputs), ports g0 and g1 (only when used as irq inputs) are schmitt-triggered inputs.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 218 of 1108 rej09b0089-0700 table 8.1 port functions port description pins mode 4 mode 5 mode 6 * 1 mode 7 * 1 port 1 ? 8-bit i/o port ? schmitt- triggered input p17/tiocb2/tclkd p16/tioca2 p15/tiocb1/tclkc p14/tioca1 8-bit i/o port also functioning as tpu i/o pins (tclka, tclkb, tclkc, tclkd, tioca0, tiocb0, tiocc0, tiocd0, tioca1, tiocb1, tioca2, tiocb2) p13/tiocd0/tclkb/a23 p12/tiocc0/tclka/a22 p11/tiocb0/a21 p10/tioca0/a20 when ddr = 0: input port also functioning as tpu i/o pins (tclka, tclkb, tioca0, tiocb0, tiocc0, tiocd0) when ddr = 1 and a23e to a20e = 1: address output when ddr = 1 and a23e to a20e = 0: dr value output port 2 ? 8-bit i/o port ? schmitt- triggered input p27/tiocb5/tmo1 p26/tioca5/tmo0 p25/tiocb4/tmci1 p24/tioca4/tmri1 p23/tiocd3/tmci0 p22/tiocc3/tmri0 p21/tiocb3 p20/tioca3 8-bit i/o port also functioning as tpu i/o pins (tioca3, tiocb3, tiocc3, tiocd3, tioca4, tiocb4, tioca5, tiocb5), and 8-bit timer (channels 0 and 1) i/o pins (tmri0, tmci0, tmo0, tmri1, tmci1, tmo1) port 3 ? 6-bit i/o port ? open-drain output capability ? schmitt- triggered input ( irq5 , irq4 ) p35/sck1/ irq5 p34/sck0/ irq4 p33/rxd1 p32/rxd0 p31/txd1 p30/txd0 6-bit i/o port also functioning as sci (channels 0 and 1) i/o pins (txd0, rxd0, sck0, txd1, rxd1, sck1) and interrupt input pins ( irq5 , irq4 )
section 8 i/o ports rev.7.00 feb. 14, 2007 page 219 of 1108 rej09b0089-0700 port description pins mode 4 mode 5 mode 6 * 1 mode 7 * 1 port 4 ? 8-bit input port p47/an7/da1 p46/an6/da0 p45/an5 p44/an4 p43/an3 p42/an2 p41/an1 p40/an0 8-bit input port also functioning as a/d converter analog inputs (an7 to an0) and d/a converter analog outputs (da1 and da0) port a ? 4-bit i/o port ? built-in mos input pull-up ? open-drain output capability pa3/a19 to pa0/a16 address output when ddr = 0 (after reset): input ports when ddr = 1: address output i/o port port b ? 8-bit i/o port ? built-in mos input pull-up pb7/a15 to pb0/a8 address output when ddr = 0 (after reset): input port when ddr = 1: address output i/o port port c ? 8-bit i/o port ? built-in mos input pull-up pc7/a7 to pc0/a0 address output when ddr = 0 (after reset): input port when ddr = 1: address output i/o port port d ? 8-bit i/o port ? built-in mos input pull-up pd7/d15 to pd0/d8 data bus input/output i/o port
section 8 i/o ports rev.7.00 feb. 14, 2007 page 220 of 1108 rej09b0089-0700 port description pins mode 4 mode 5 mode 6 * 1 mode 7 * 1 port e ? 8-bit i/o port ? built-in mos input pull-up pe7/d7 to pe0/d0 in 8-bit bus mode: i/o port in 16-bit bus mode: data bus input/output i/o port port f ? 8-bit i/o port ? schmitt- triggered input ( irq3 to irq0 ) pf7/ when ddr = 0: input port when ddr = 1 (after reset): output when ddr = 0 (after reset): input port when ddr = 1: output pf6/ as when asod = 1: i/o port when asod = 0: as output i/o port pf5/ rd pf4/ hwr rd , hwr output pf3/ lwr / irq3 in 8-bit bus mode: when lwrod = 1, i/o port in 16-bit bus mode: lwr output also functioning as interrupt input pin ( irq3 ) i/o port also functioning as interrupt input pins ( irq3 to irq0 ) pf2/ wait / irq2 / breqo when waite = 0, brle = 0, breqoe = 0 (after reset): i/o port also functioning as interrupt input pin ( irq2 ) when waite = 1: wait input also functioning as interrupt input pin ( irq2 ) when waite = 0, brle = 1, breqoe = 1: breqo output also functioning as interrupt input pin ( irq2 ) pf1/ back / irq1 / cs5 pf0/ breq / irq0 / cs4 when brle = 0 (after reset): i/o port also functioning as interrupt input pins ( irq1 , irq0 ) when cs25e = 1, pf1cs5s = 1, and ddr = 1: also functions as cs5 output when cs25e = 1, pf0cs4s = 1, and ddr = 1: also functions as cs4 output when brle = 1: breq input, back output also functioning as interrupt input pins ( irq1 , irq0 )
section 8 i/o ports rev.7.00 feb. 14, 2007 page 221 of 1108 rej09b0089-0700 port description pins mode 4 mode 5 mode 6 * 1 mode 7 * 1 port g pg4/ cs0 when ddr = 0 * 2 : input port when ddr = 1 * 3 : cs0 output ? 5-bit i/o port ? schmitt- triggered input ( irq7 , irq6 ) pg3/ cs1 / cs7 i/o port when ddr = 1, cs167e = 1, and css17 = 0: also functions as cs1 output when ddr = 1, cs167e = 1, and css17 = 1: also functions as cs7 output pg2/ cs2 i/o port when ddr = 1 and cs25e = 1: also functions as cs2 output i/o port also functions as interrupt input pins ( irq7 , irq6 ) and a/d converter input pin ( adtrg ) pg1/ cs3 / irq7 / cs6 i/o port when ddr = 1, cs25e = 1, and css36 = 0: also functions as cs3 output when ddr = 1, css36 = 1, and cs167e = 1: also functions as cs6 output and interrupt input pin ( irq7 ) pg0/ irq6 / adtrg i/o port also functioning as interrupt input pin ( irq6 ) and a/d converter input pin ( adtrg ) notes: 1. modes 6 and 7 are not available in the romless versions. 2. after a reset in mode 6 3. after a reset in mode 4 or 5
section 8 i/o ports rev.7.00 feb. 14, 2007 page 222 of 1108 rej09b0089-0700 8.2 port 1 8.2.1 overview port 1 is an 8-bit i/o port. port 1 pins also function as tpu i/o pins (tclka, tclkb, tclkc, tclkd, tioca0, tiocb0, tiocc0, tiocd0, tioca1, tiocb1, tioca2, and tiocb2) and an address bus output function. port 1 pin functions change according to the operating mode. the address output or port output function is selected according to the settings of bits a23e to a20e in pfcr1. port 1 pins have schmitt-trigger inputs. figure 8.1 shows the port 1 pin configuration. p17 (i/o)/tiocb2 (i/o)/tclkd (input) p16 (i/o)/tioca2 (i/o) p15 (i/o)/tiocb1 (i/o)/tclkc (input) p14 (i/o)/tioca1 (i/o) p13 (i/o)/tiocd0 (i/o)/tclkb (input)/a23 (output) p12 (i/o)/tiocc0 (i/o)/tclka (input)/a22 (output) p11 (i/o)/tiocb0 (i/o)/a21 (output) p10 (i/o)/tioca0 (i/o)/a20 (output) port 1 note: * modes 6 and 7 are not available in the romless versions. port 1 pins p17 (i/o)/tiocb2 (i/o)/tclkd (input) p16 (i/o)/tioca2 (i/o) p15 (i/o)/tiocb1 (i/o)/tclkc (input) p14 (i/o)/tioca1 (i/o) p13 (i/o)/tiocd0 (i/o)/tclkb (input) p12 (i/o)/tiocc0 (i/o)/tclka (input) p11 (i/o)/tiocb0 (i/o) p10 (i/o)/tioca0 (i/o) pin functions in mode 7 * p17 (i/o)/tiocb2 (i/o)/tclkd (input) p16 (i/o)/tioca2 (i/o) p15 (i/o)/tiocb1 (i/o)/tclkc (input) p14 (i/o)/tioca1 (i/o) p13 (i/o)/tiocd0 (i/o)/tclkb (input)/a23 (output) p12 (i/o)/tiocc0 (i/o)/tclka (input)/a22 (output) p11 (i/o)/tiocb0 (i/o)/a21 (output) p10 (i/o)/tioca0 (i/o)/a20 (output) pin functions in modes 4 to 6 * figure 8.1 port 1 pin functions
section 8 i/o ports rev.7.00 feb. 14, 2007 page 223 of 1108 rej09b0089-0700 8.2.2 register configuration table 8.2 shows the port 1 register configuration. table 8.2 port 1 registers name abbreviation r/w initial value address * port 1 data direction register p1ddr w h'00 h'feb0 port 1 data register p1dr r/w h'00 h'ff60 port 1 register port1 r undefined h'ff50 port function control register 1 pfcr1 r/w h'0f h'ff45 note: * lower 16 bits of the address. port 1 data directio n register (p1ddr) bit : 7 6 5 4 3 2 1 0 p17ddr p16ddr p15ddr p14ddr p13ddr p12ddr p11ddr p10ddr initial value : 0 0 0 0 0 0 0 0 r/w : w w w w w w w w p1ddr is an 8-bit write-only register, the individual bits of which specify input or output for the pins of port 1. p1ddr cannot be read; if it is, an undefined value will be read. setting a p1ddr bit to 1 makes the corresponding port 1 pins output pins, while clearing the bit to 0 makes the pins input pins. p1ddr is initialized to h'00 by a reset, and in hardware standby mode. it retains its prior state in software standby mode. whether the address output pins maintain their output state or go to the high-impedance state in a transition to software standby mode is selected by the ope bit in sbycr.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 224 of 1108 rej09b0089-0700 port 1 data register (p1dr) bit : 7 6 5 4 3 2 1 0 p17dr p16dr p15dr p14dr p13dr p12dr p11dr p10dr initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w p1dr is an 8-bit readable/writable register that stores output data for the port 1 pins (p17 to p10). p1dr is initialized to h'00 by a reset, and in hardware standby mode. it retains its prior state in software standby mode. port 1 register (port1) bit : 7 6 5 4 3 2 1 0 p17 p16 p15 p14 p13 p12 p11 p10 initial value : ? * ? * ? * ? * ? * ? * ? * ? * r/w : r r r r r r r r note: * determined by state of pins p17 to p10. port1 is an 8-bit read-only register that shows the pin states. it cannot be written to. writing of output data for the port 1 pins (p17 to p10) must always be performed on p1dr. if a port 1 read is performed while p1ddr bits are set to 1, the p1dr values are read. if a port 1 read is performed while p1ddr bits are cl eared to 0, the pin states are read. after a reset and in hardware standby mode, port1 contents are determined by the pin states, as p1ddr and p1dr are initialized. port1 retains its prior state in software standby mode.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 225 of 1108 rej09b0089-0700 port function control register 1 (pfcr1) bit : 7 6 5 4 3 2 1 0 css17 css36 pf1cs5s pf0cs4s a23e a22e a21e a20e initial value : 0 0 0 0 1 1 1 1 r/w : r/w r/w r/w r/w r/w r/w r/w r/w pfcr1 is an 8-bit readable/writable register that performs i/o port control. pfcr1 is initialized to h'0f by a reset, and in hardware standby mode. bit 7?cs17 select (css17): selects whether cs1 or cs7 is output from the pg3 pin. for details, see section 8.12, port g. bit 6?cs36 select (css36): selects whether cs3 or cs6 is output from the pg1 pin. for details, see section 8.12, port g. bit 5?port f1 chip sel ect 5 select (pf1cs5s): selects enabling or disabling of cs5 output. for details, see section 8.11, port f. bit 4?port f0 chip sel ect 4 select (pf0cs4s): selects enabling or disabling of cs4 output. for details, see section 8.11, port f. bit 3?address 23 enable (a23e): enables or disables address output 23 (a23). this bit is valid in modes 4 to 6. bit 3 a23e description 0 p13dr is output when p13ddr = 1 1 a23 is output when p13ddr = 1 (initial value) bit 2?address 22 enable (a22e): enables or disables address output 22 (a22). this bit is valid in modes 4 to 6. bit 2 a22e description 0 p12dr is output when p12ddr = 1 1 a22 is output when p12ddr = 1 (initial value)
section 8 i/o ports rev.7.00 feb. 14, 2007 page 226 of 1108 rej09b0089-0700 bit 1?address 21 enable (a21e): enables or disables address output 21 (a21). this bit is valid in modes 4 to 6. bit 1 a21e description 0 p11dr is output when p11ddr = 1 1 a21 is output when p11ddr = 1 (initial value) bit 0?address 20 enable (a20e): enables or disables address output 20 (a20). this bit is valid in modes 4 to 6. bit 0 a20e description 0 p10dr is output when p10ddr = 1 1 a20 is output when p10ddr = 1 (initial value)
section 8 i/o ports rev.7.00 feb. 14, 2007 page 227 of 1108 rej09b0089-0700 8.2.3 pin functions port 1 pins also function as tpu i/o pins (tclka, tclkb, tclkc, tclkd, tioca0, tiocb0, tiocc0, tiocd0, tioca1, tiocb1, tioc a2, and tiocb2) and address output pins (a23 to a20). port 1 pin functions are shown in table 8.3. table 8.3 port 1 pin functions pin selection method and pin functions p17/tiocb2/ tclkd the pin function is switched as shown below according to the combination of the tpu channel 2 setting by bits md3 to md0 in tmdr2, bits iob3 to iob0 in tior2, bits cclr1 and cclr0 in tcr2, bits tpsc2 to tpsc0 in tcr0 and tcr5, and bit p17ddr. tpu channel 2 setting table below (1) table below (2) p17ddr ? 0 1 pin function tiocb2 output p17 input p17 output tiocb2 input * 1 tclkd input * 2 tpu channel 2 setting (2) (1) (2) (2) (1) (2) md3 to md0 b'0000, b'01 b'0010 b'0011 iob3 to iob0 b'0000 b'0100 b'1 b'0001 to b'0011 b'0101 to b'0111 ? b' 00 other than b' 00 cclr1, cclr0 ? ? ? ? other than b'10 b'10 output function ? output compare output ? ? pwm mode 2 output ? : don?t care notes: 1. tiocb2 input when md3 to md0 = b'0000 or b'01 and iob3 = 1. 2. tclkd input when the setting for either tcr0 or tcr5 is: tpsc2 to tpsc0 = b'111. tclkd input when channels 2 and 4 are set to phase counting mode (md3 to md0 = b'01 ).
section 8 i/o ports rev.7.00 feb. 14, 2007 page 228 of 1108 rej09b0089-0700 pin selection method and pin functions p16/tioca2 the pin function is switched as shown below according to the combination of the tpu channel 2 setting by bits md3 to md0 in tmdr2, bits ioa3 to ioa0 in tior2, bits cclr1 and cclr0 in tcr2, and bit p16ddr. tpu channel 2 setting table below (1) table below (2) p16ddr ? 0 1 pin function tioca2 output p16 input p16 output tioca2 input * 1 tpu channel 2 setting (2) (1) (2) (1) (1) (2) md3 to md0 b'0000, b'01 b'001 b'0011 b'0011 ioa3 to ioa0 b'0000 b'0100 b'1 b'0001 to b'0011 b'0101 to b'0111 b' 00 other than b' 00 cclr1, cclr0 ? ? ? ? other than b'01 b'01 output function ? output compare output ? pwm mode 1 output * 2 pwm mode 2 output ? : don?t care notes: 1. tioca2 input when md3 to md0 = b'0000 or b'01 and ioa3 = 1. 2. tiocb2 output is disabled.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 229 of 1108 rej09b0089-0700 pin selection method and pin functions p15/tiocb1/ tclkc the pin function is switched as shown below according to the combination of the tpu channel 1 setting by bits md3 to md0 in tmdr1, bits iob3 to iob0 in tior1, bits cclr1 and cclr0 in t cr1, bits tpsc2 to tpsc0 in tcr0, tcr2, tcr4, and tcr5, and bit p15ddr. tpu channel 1 setting table below (1) table below (2) p15ddr ? 0 1 pin function tiocb1 output p15 input p15 output tiocb1 input * 1 tclkc input * 2 tpu channel 1 setting (2) (1) (2) (2) (1) (2) md3 to md0 b'0000, b'01 b'0010 b'0011 iob3 to iob0 b'0000 b'0100 b'1 b'0001 to b'0011 b'0101 to b'0111 ? b' 00 other than b' 00 cclr1, cclr0 ? ? ? ? other than b'10 b'10 output function ? output compare output ? ? pwm mode 2 output ? : don?t care notes: 1. tiocb1 input when md3 to md0 = b'0000 or b'01 and iob3 to iob0 = b'10 . 2. tclkc input when the setting for either tcr0 or tcr2 is: tpsc2 to tpsc0 = b'110; or when the setting for either tcr4 or tcr5 is tpsc2 to tpsc0 = b'101. tclkc input when channels 2 and 4 are set to phase counting mode (md3 to md0 = b'01 ).
section 8 i/o ports rev.7.00 feb. 14, 2007 page 230 of 1108 rej09b0089-0700 pin selection method and pin functions p14/tioca1 the pin function is switched as shown below according to the combination of the tpu channel 1 setting by bits md3 to md0 in tmdr1, bits ioa3 to ioa0 in tior1, bits cclr1 and cclr0 in tcr1, and bit p14ddr. tpu channel 1 setting table below (1) table below (2) p14ddr ? 0 1 pin function tioca1 output p14 input p14 output tioca1 input * 1 tpu channel 1 setting (2) (1) (2) (1) (1) (2) md3 to md0 b'0000, b'01 b'001 b'0010 b'0011 ioa3 to ioa0 b'0000 b'0100 b'1 b'0001 to b'0011 b'0101 to b'0111 b' 00 other than b' 00 cclr1, cclr0 ? ? ? ? other than b'01 b'01 output function ? output compare output ? pwm mode 1 output * 2 pwm mode 2 output ? : don't care notes: 1. tioca1 input when md3 to md0 = b'0000 or b'01 and ioa3 to ioa0 = b'10 . 2. tiocb1 output is disabled.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 231 of 1108 rej09b0089-0700 pin selection method and pin functions p13/tiocd0/ tclkb/a23 the pin function is switched as shown below according to the combination of the operating mode, tpu channel 0 setting (by bits md3 to md0 in tmdr0, bits iod3 to iod0 in tior0l, and bits cclr2 to cclr0 in tcr0), bits tpsc2 to tpsc0 in tcr0 to tcr2, bit a23e in pfcr1, and bit p13ddr. operating mode mode 7 * 1 modes 4 to 6 * 1 tpu channel 0 setting table below (1) table below (2) table below (1) table below (2) p13ddr ? 0 1 0 1 0 1 a23e ? ? ? ? 0 1 ? 0 1 pin function tiocd0 output p13 input p13 output tiocd0 output tiocd0 output a23 output p13 input p13 output a23 output tiocd0 input * 2 tiocd0 input * 2 tclkb input * 3 tpu channel 0 setting (2) (1) (2) (2) (1) (2) md3 to md0 b'0000 b'0010 b'0011 iod3 to iod0 b'0000 b'0100 b'1 b'0001 to b'0011 b'0101 to b'0111 ? b' 00 other than b' 00 cclr2 to cclr0 ? ? ? ? other than b'110 b'110 output function ? output compare output ? ? pwm mode 2 output ? : don?t care notes: 1. modes 6 and 7 are not available in the romless versions. 2. tiocd0 input when md3 to md0 = b'0000 and iod3 to iod0 = b'10 . 3. tclkb input when the tcr0, tcr1, or tcr2 setting is: tpsc2 to tpsc0 = b'101. tclkb input when channels 1 and 5 are set to phase counting mode (md3 to md0 = b'01 ).
section 8 i/o ports rev.7.00 feb. 14, 2007 page 232 of 1108 rej09b0089-0700 pin selection method and pin functions p12/tiocc0/ tclka/a22 the pin function is switched as shown below according to the combination of the operating mode, tpu channel 0 setting (by bits md3 to md0 in tmdr0, bits ioc3 to ioc0 in tior0l, and bits cclr2 to cclr0 in tcr0), bits tpsc2 to tpsc0 in tcr0 to tcr5, bit a22e in pfcr1 and bit p12ddr. operating mode mode 7 * 1 modes 4 to 6 * 1 tpu channel 0 setting table below (1) table below (2) table below (1) table below (2) p12ddr ? 0 1 0 1 0 1 a22e ? ? ? ? 0 1 ? 0 1 pin function tiocc0 output p12 input p12 output tiocc0 output tiocc0 output a22 output p12 input p12 output a22 output tiocc0 input * 2 tiocc0 input * 2 tclka input * 3 tpu channel 0 setting (2) (1) (2) (1) (1) (2) md3 to md0 b'0000 b'001 b'0010 b'0011 ioc3 to ioc0 b'0000 b'0100 b'1 b'0001 to b'0011 b'0101 to b'0111 b' 00 other than b' 00 cclr2 to cclr0 ? ? ? ? other than b'101 b'101 output function ? output compare output ? pwm mode 1 output * 4 pwm mode 2 output ? : don?t care notes: 1. modes 6 and 7 are not available in the romless versions. 2. tiocc0 input when md3 to md0 = b'0000 and ioc3 to ioc0 = b'10 . 3. tclka input when the tcr0 to tcr5 setting is: tpsc2 to tpsc0 = b'100. tclka input when channel 1 and 5 are set to phase counting mode (md3 to md0 = b'01 ). 4. tiocd0 output is disabled. when bfa = 1 or bfb = 1 in tmdr0, output is disabled and setting (2) applies.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 233 of 1108 rej09b0089-0700 pin selection method and pin functions p11/tiocb0/ a21 the pin function is switched as shown below according to the combination of the operating mode, tpu channel 0 setting (by bits md3 to md0 in tmdr0, bits iob3 to iob0 in tior0h, and bits cclr2 to cclr0 in tcr0), bit a21e in pfcr1 and bit p11ddr. operating mode mode 7 * 1 modes 4 to 6 * 1 tpu channel 0 setting table below (1) table below (2) table below (1) table below (2) p11ddr ? 0 1 0 1 0 1 a21e ? ? ? ? 0 1 ? 0 1 pin function tiocb0 output p11 input p11 output tiocb0 output tiocb0 output a21 output p11 input p11 output a21 output tiocb0 input * 2 tiocb0 input * 2 tpu channel 0 setting (2) (1) (2) (2) (1) (2) md3 to md0 b'0000 b'0010 b'0011 iob3 to iob0 b'0000 b'0100 b'1 b'0001 to b'0011 b'0101 to b'0111 ? b' 00 other than b' 00 cclr2 to cclr0 ? ? ? ? other than b'010 b'010 output function ? output compare output ? ? pwm mode 2 output ? : don?t care notes: 1. modes 6 and 7 are not available in the romless versions. 2. tiocb0 input when md3 to md0 = b'0000 and iob3 to iob0 = b'10 .
section 8 i/o ports rev.7.00 feb. 14, 2007 page 234 of 1108 rej09b0089-0700 pin selection method and pin functions p10/tioca0/ a20 the pin function is switched as shown below according to the combination of the operating mode, tpu channel 0 setting (by bits md3 to md0 in tmdr0, bits ioa3 to ioa0 in tior0h, and bits cclr2 to cclr0 in tcr0), bit a20e in pfcr1 and bit p10ddr. operating mode mode 7 * 1 modes 4 to 6 * 1 tpu channel 0 setting table below (1) table below (2) table below (1) table below (2) p10ddr ? 0 1 0 1 0 1 a20e ? ? ? ? 0 1 ? 0 1 pin function tioca0 output p10 input p10 output tioca0 output tioca0 output a20 output p10 input p10 output a20 output tioca0 input * 2 tioca0 input * 2 tpu channel 0 setting (2) (1) (2) (1) (1) (2) md3 to md0 b'0000 b'001 b'0010 b'0011 ioa3 to ioa0 b'0000 b'0100 b'1 b'0001 to b'0011 b'0101 to b'0111 b' 00 other than b' 00 cclr2 to cclr0 ? ? ? ? other than b'001 b'001 output function ? output compare output ? pwm mode 1 output * 3 pwm mode 2 output ? : don?t care notes: 1. modes 6 and 7 are not available in the romless versions. 2. tioca0 input when md3 to md0 = b'0000 and ioa3 to ioa0 = b'10 . 3. tiocb0 output is disabled.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 235 of 1108 rej09b0089-0700 8.3 port 2 8.3.1 overview port 2 is an 8-bit i/o port. port 2 pins also function as tpu i/o pins (tioca3, tiocb3, tiocc3, tiocd3, tioca4, tiocb4, tioca5 , and tiocb5), and 8-bit timer i/o pins (tmri0, tmci0, tmo0, tmri1, tmci1, and tmo1). port 2 pin functions are the same in all operating modes. port 2 uses schmitt-triggered input. figure 8.2 shows the port 2 pin configuration. p27 (i/o)/tiocb5 (i/o)/tmo1 (output) p26 (i/o)/tioca5 (i/o)/tmo0 (output) p25 (i/o)/tiocb4 (i/o)/tmci1 (input) p24 (i/o)/tioca4 (i/o)/tmri1 (input) p23 (i/o)/tiocd3 (i/o)/tmci0 (input) p22 (i/o)/tiocc3 (i/o)/tmri0 (input) p21 (i/o)/tiocb3 (i/o) p20 (i/o)/tioca3 (i/o) port 2 port 2 pins figure 8.2 port 2 pin functions 8.3.2 register configuration table 8.4 shows the port 2 register configuration. table 8.4 port 2 registers name abbreviation r/w initial value address * port 2 data direction register p2ddr w h'00 h'feb1 port 2 data register p2dr r/w h'00 h'ff61 port 2 register port2 r undefined h'ff51 note: * lower 16 bits of the address.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 236 of 1108 rej09b0089-0700 port 2 data directio n register (p2ddr) bit : 7 6 5 4 3 2 1 0 p27ddr p26ddr p25ddr p24ddr p23ddr p22ddr p21ddr p20ddr initial value : 0 0 0 0 0 0 0 0 r/w : w w w w w w w w p2ddr is an 8-bit write-only register, the individual bits of which specify input or output for the pins of port 2. p2ddr cannot be read; if it is, an undefined value will be read. setting p2ddr bits to 1 makes the corresponding port 2 pins output pins, while clearing the bits to 0 makes the pins input pins. p2ddr is initialized to h'00 by a reset, and in hardware standby mode. it retains its prior state in software standby mode. port 2 data register (p2dr) bit : 7 6 5 4 3 2 1 0 p27dr p26dr p25dr p24dr p23dr p22dr p21dr p20dr initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w p2dr is an 8-bit readable/writable register that stores output data for the port 2 pins (p27 to p20). p2dr is initialized to h'00 by a reset, and in hardware standby mode. it retains its prior state in software standby mode.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 237 of 1108 rej09b0089-0700 port 2 register (port2) bit : 7 6 5 4 3 2 1 0 p27 p26 p25 p24 p23 p22 p21 p20 initial value : ? * ? * ? * ? * ? * ? * ? * ? * r/w : r r r r r r r r note: * determined by state of pins p27 to p20. port2 is an 8-bit read-only register that shows the pin states. it cannot be written to. writing of output data for the port 2 pins (p27 to p20) must always be performed on p2dr. if a port 2 read is performed while p2ddr bits are set to 1, the p2dr values are read. if a port 2 read is performed while p2ddr bits are cl eared to 0, the pin states are read. after a reset and in hardware standby mode, port2 contents are determined by the pin states, as p2ddr and p2dr are initialized. port2 retains its prior state in software standby mode.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 238 of 1108 rej09b0089-0700 8.3.3 pin functions port 2 pins also function as tpu i/o pins (tioca3, tiocb3, tiocc3, tiocd3, tioca4, tiocb4, tioca5, and tiocb5), and 8-bit timer i/o pins (tmri0, tmci0, tmo0, tmri1, tmci1, and tmo1). port 2 pin functions are shown in table 8.5. table 8.5 port 2 pin functions pin selection method and pin functions p27/tiocb5/ tmo1 the pin function is switched as shown below according to the combination of the tpu channel 5 setting by bits md3 to md0 in tmdr5, bits iob3 to iob0 in tior5, bits cclr1 and cclr0 in tcr5, bits os3 to os0 in tcsr1, and bit p27ddr. os3 to os0 all 0 any 1 tpu channel 5 setting table below (1) table below (2) ? p27ddr ? 0 1 ? pin function tiocb5 output p27 input p27 output tmo1 output tiocb5 input * tpu channel 5 setting (2) (1) (2) (2) (1) (2) md3 to md0 b'0000, b'01 b'0010 b'0011 iob3 to iob0 b'0000 b'0100 b'1 b'0001 to b'0011 b'0101 to b'0111 ? b' 00 other than b' 00 cclr1, cclr0 ? ? ? ? other than b'10 b'10 output function ? output compare output ? ? pwm mode 2 output ? : don?t care note: * tiocb5 input when md3 to md0 = b'0000 or b'01 and iob3 = 1.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 239 of 1108 rej09b0089-0700 pin selection method and pin functions p26/tioca5/ tmo0 the pin function is switched as shown below according to the combination of the tpu channel 5 setting by bits md3 to md0 in tmdr5, bits ioa3 to ioa0 in tior5, bits cclr1 and cclr0 in tcr5, bits os3 to os0 in tcsr0, and bit p26ddr. os3 to os0 all 0 any 1 tpu channel 5 setting table below (1) table below (2) ? p26ddr ? 0 1 ? pin function tioca5 output p26 input p26 output tmo0 output tioca5 input * 1 tpu channel 5 setting (2) (1) (2) (1) (1) (2) md3 to md0 b'0000, b'01 b'001 b'0010 b'0011 ioa3 to ioa0 b'0000 b'0100 b'1 b'0001 to b'0011 b'0101 to b'0111 b' 00 other than b' 00 cclr1, cclr0 ? ? ? ? other than b'01 b'01 output function ? output compare output ? pwm mode 1 output * 2 pwm mode 2 output ? : don?t care notes: 1. tioca5 input when md3 to md0 = b'0000 or b'01 and ioa3 = 1. 2. tiocb5 output is disabled.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 240 of 1108 rej09b0089-0700 pin selection method and pin functions p25/tiocb4/ tmci1 this pin is used as the 8-bit timer external clock input pin when external clock is selected with bits cks2 to cks0 in tcr1. the pin function is switched as shown below according to the combination of the tpu channel 4 setting by bits md3 to md0 in tmdr4 and bits iob3 to iob0 in tior4, bits cclr1 and cclr0 in tcr4, and bit p25ddr. tpu channel 4 setting table below (1) table below (2) p25ddr ? 0 1 pin function tiocb4 output p25 input p25 output tiocb4 input * tmci1 input tpu channel 4 setting (2) (1) (2) (2) (1) (2) md3 to md0 b'0000, b'01 b'0010 b'0011 iob3 to iob0 b'0000 b'0100 b'1 b'0001 to b'0011 b'0101 to b'0111 ? b' 00 other than b' 00 cclr1, cclr0 ? ? ? ? other than b'10 b'10 output function ? output compare output ? ? pwm mode 2 output ? : don?t care note: * tiocb4 input when md3 to md0 = b'0000 or b'10 and iob3 to iob0 = b'10 .
section 8 i/o ports rev.7.00 feb. 14, 2007 page 241 of 1108 rej09b0089-0700 pin selection method and pin functions p24/tioca4/ tmri1 this pin is used as the 8-bit timer counter reset pin when bits cclr1 and cclr0 in tcr1 are both set to 1. the pin function is switched as shown below according to the combination of the tpu channel 4 setting by bits md3 to md0 in tmdr4, bits ioa3 to ioa0 in tior4, bits cclr1 and cclr0 in tcr4, and bit p24ddr. tpu channel 4 setting table below (1) table below (2) p24ddr ? 0 1 pin function tioca4 output p24 input p24 output tioca4 input * 1 tmri1 input tpu channel 4 setting (2) (1) (2) (1) (1) (2) md3 to md0 b'0000, b'01 b'001 b'0010 b'0011 ioa3 to ioa0 b'0000 b'0100 b'1 b'0001 to b'0011 b'0101 to b'0111 b' 00 other than b' 00 cclr1, cclr0 ? ? ? ? other than b'01 b'01 output function ? output compare output ? pwm mode 1 output * 2 pwm mode 2 output ? : don?t care notes: 1. tioca4 input when md3 to md0 = b'0000 or b'01 and ioa3 to ioa0 = b'10 . 2. tiocb4 output is disabled.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 242 of 1108 rej09b0089-0700 pin selection method and pin functions p23/tiocd3/ tmci0 this pin is used as the 8-bit timer external clock input pin when external clock is selected with bits cks2 to cks0 in tcr0. the pin function is switched as shown below according to the combination of the tpu channel 3 setting by bits md3 to md0 in tmdr3, bits iod3 to iod0 in tior3l, bits cclr2 to cclr0 in tcr3, and bit p23ddr. tpu channel 3 setting table below (1) table below (2) p23ddr ? 0 1 pin function tiocd3 output p23 input p23 output tiocd3 input * tmci0 input tpu channel 3 setting (2) (1) (2) (2) (1) (2) md3 to md0 b'0000 b'0010 b'0011 iod3 to iod0 b'0000 b'0100 b'1 b'0001 to b'0011 b'0101 to b'0111 ? b' 00 other than b' 00 cclr2 to cclr0 ? ? ? ? other than b'110 b'110 output function ? output compare output ? ? pwm mode 2 output ? : don?t care note: * tiocd3 input when md3 to md0 = b'0000 and iod3 to iod0 = b'10 .
section 8 i/o ports rev.7.00 feb. 14, 2007 page 243 of 1108 rej09b0089-0700 pin selection method and pin functions p22/tiocc3/ tmri0 this pin is used as the 8-bit timer counter reset pin when bits cclr1 and cclr0 in tcr0 are both set to 1. the pin function is switched as shown below according to the combination of the tpu channel 3 setting by bits md3 to md0 in tmdr3, bits ioc3 to ioc0 in tior3l, bits cclr2 to cclr0 in tcr3, and bit p22ddr. tpu channel 3 setting table below (1) table below (2) p22ddr ? 0 1 pin function tiocc3 output p22 input p22 output tiocc3 input * 1 tmri0 input tpu channel 3 setting (2) (1) (2) (1) (1) (2) md3 to md0 b'0000 b'001 b'0010 b'0011 ioc3 to ioc0 b'0000 b'0100 b'1 b'0001 to b'0011 b'0101 to b'0111 b' 00 other than b' 00 cclr2 to cclr0 ? ? ? ? other than b'101 b'101 output function ? output compare output ? pwm mode 1 output * 2 pwm mode 2 output ? : don?t care notes: 1. tiocc3 input when md3 to md0 = b'0000 and ioc3 to ioc0 = b'10 . 2. tiocd3 output is disabled. when bfa = 1 or bfb = 1 in tmdr3, output is disabled and setting (2) applies.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 244 of 1108 rej09b0089-0700 pin selection method and pin functions p21/tiocb3 the pin function is switched as shown below according to the combination of the tpu channel 3 setting by bits md3 to md0 in tmdr3, bits iob3 to iob0 in tior3h, bits cclr2 to cclr0 in tcr3, and bit p21ddr. tpu channel 3 setting table below (1) table below (2) p21ddr ? 0 1 pin function tiocb3 output p21 input p21 output tiocb3 input * tpu channel 3 setting (2) (1) (2) (2) (1) (2) md3 to md0 b'0000 b'0010 b'0011 iob3 to iob0 b'0000 b'0100 b'1 b'0001 to b'0011 b'0101 to b'0111 ? b' 00 other than b' 00 cclr2 to cclr0 ? ? ? ? other than b'010 b'010 output function ? output compare output ? ? pwm mode 2 output ? : don?t care note: * tiocb3 input when md3 to md0 = b'0000 and iob3 to iob0 = b'10 .
section 8 i/o ports rev.7.00 feb. 14, 2007 page 245 of 1108 rej09b0089-0700 pin selection method and pin functions p20/tioca3 the pin function is switched as shown below according to the combination of the tpu channel 3 setting by bits md3 to md0 in tmdr3, bits ioa3 to ioa0 in tior3h, bits cclr2 to cclr0 in tcr3, and bit p20ddr. tpu channel 3 setting table below (1) table below (2) p20ddr ? 0 1 pin function tioca3 output p20 input p20 output tioca3 input * 1 tpu channel 3 setting (2) (1) (2) (1) (1) (2) md3 to md0 b'0000 b'001 b'0010 b'0011 ioa3 to ioa0 b'0000 b'0100 b'1 b'0001 to b'0011 b'0101 to b'0111 b' 00 other than b' 00 cclr2 to cclr0 ? ? ? ? other than b'001 b'001 output function ? output compare output ? pwm mode 1 output * 2 pwm mode 2 output ? : don?t care notes: 1. tioca3 input when md3 to md0 = b'0000 and ioa3 to ioa0 = b'10 . 2. tiocb3 output is disabled.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 246 of 1108 rej09b0089-0700 8.4 port 3 8.4.1 overview port 3 is a 6-bit i/o port. port 3 pins also function as sci i/o pins (txd0, rxd0, sck0, txd1, rxd1, and sck1) and interrupt input pins ( irq4 , irq5 ). port 3 pin functions are the same in all operating modes. the interrupt input pins ( irq4 , irq5 ) are schmitt-triggered inputs. figure 8.3 shows the port 3 pin configuration. p35 p34 p33 p32 p31 p30 (i/o)/ (i/o)/ (i/o)/ (i/o)/ (i/o)/ (i/o)/ sck1 sck0 rxd1 rxd0 txd1 txd0 (i/o)/ (i/o)/ (input) (input) (output) (output) port 3 pins port 3 irq5 (input) irq4 (input) figure 8.3 port 3 pin functions 8.4.2 register configuration table 8.6 shows the port 3 register configuration. table 8.6 port 3 registers name abbreviation r/w initial value * 1 address * 2 port 3 data direction register p3ddr w h'00 h'feb2 port 3 data register p3dr r/w h'00 h'ff62 port 3 register port3 r undefined h'ff52 port 3 open drain control register p3odr r/w h'00 h'ff76 notes: 1. value of bits 5 to 0. 2. lower 16 bits of the address.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 247 of 1108 rej09b0089-0700 port 3 data directio n register (p3ddr) bit : 7 6 5 4 3 2 1 0 ? ? p35ddr p34ddr p33ddr p32ddr p31ddr p30ddr initial value : undefined undefined 0 0 0 0 0 0 r/w : ? ? w w w w w w p3ddr is an 8-bit write-only register, the individual bits of which specify input or output for the pins of port 3. bits 7 and 6 are reserved. p3ddr cannot be read; if it is, an undefined value will be read. setting p3ddr bits to 1 makes the corresponding port 3 pins output pins, while clearing the bits to 0 makes the pins input pins. p3ddr is initialized to h'00 (bits 5 to 0) by a reset, and in hardware standby mode. it retains its prior state in software standby mode. as the sci is initialized, the pin states are determined by the p3ddr and p3dr specifications. port 3 data register (p3dr) bit : 7 6 5 4 3 2 1 0 ? ? p35dr p34dr p33dr p32dr p31dr p30dr initial value : undefined undefined 0 0 0 0 0 0 r/w : ? ? r/w r/w r/w r/w r/w r/w p3dr is an 8-bit readable/writable register that stores output data for the port 3 pins (p35 to p30). bits 7 and 6 are reserved; they return an undetermined value if read, and cannot be modified. p3dr is initialized to h'00 (bits 5 to 0) by a on reset, and in hardware standby mode. it retains its prior state in software standby mode.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 248 of 1108 rej09b0089-0700 port 3 register (port3) bit : 7 6 5 4 3 2 1 0 ? ? p35 p34 p33 p32 p31 p30 initial value : undefined undefined ? * ? * ? * ? * ? * ? * r/w : ? ? r r r r r r note: * determined by state of pins p35 to p30. port3 is an 8-bit read-only register that shows the pin states, and cannot be modified. writing of output data for the port 3 pins (p35 to p30) must always be performed on p3dr. bits 7 and 6 are reserved; they return an undetermined value if read, and cannot be modified. if a port 3 read is performed while p3ddr bits are set to 1, the p3dr values are read. if a port 3 read is performed while p3ddr bits are cl eared to 0, the pin states are read. after a reset and in hardware standby mode, port3 contents are determined by the pin states, as p3ddr and p3dr are initialized. port3 retains its prior state in software standby mode. port 3 open drain co ntrol register (p3odr) bit : 7 6 5 4 3 2 1 0 ? ? p35odr p34odr p33odr p32odr p31odr p30odr initial value : undefined undefined 0 0 0 0 0 0 r/w : ? ? r/w r/w r/w r/w r/w r/w p3odr is an 8-bit readable/writable register that controls the pmos on/off status for each port 3 pin (p35 to p30). bits 7 and 6 are reserved; they return an undetermined value if read, and cannot be modified. setting p3odr bits to 1 makes the corresponding port 3 pins nmos open-drain output pins, while clearing the bits to 0 makes the pins cmos output pins. p3odr is initialized to h'00 (bits 5 to 0) by a reset, and in hardware standby mode. it retains its prior state in software standby mode.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 249 of 1108 rej09b0089-0700 8.4.3 pin functions port 3 pins also function as sci i/o pins (txd0, rxd0, sck0, txd1, rxd1, and sck1) and interrupt input pins ( irq4 , irq5 ). port 3 pin functions are shown in table 8.7. table 8.7 port 3 pin functions pin selection method and pin functions p35/sck1/ irq5 the pin function is switched as shown below according to the combination of bit c/ a in the sci1 smr, bits cke0 and cke1 in scr, and bit p35ddr. cke1 0 1 c/ a 0 1 ? cke0 0 1 ? ? p35ddr 0 1 ? ? ? pin function p35 input pin p35 output pin * 1 sck1 output pin * 1 sck1 output pin * 1 sck1 input pin irq5 interrupt input pin * 2 notes: 1. when p35odr = 1, the pin becomes an nmos open-drain output. 2. when this pin is used as an external interrupt input, it should not be used as an input/output pin with other functions. p34/sck0/ irq4 the pin function is switched as shown below according to the combination of bit c/ a in the sci0 smr, bits cke0 and cke1 in scr, and bit p34ddr. cke1 0 1 c/ a 0 1 ? cke0 0 1 ? ? p34ddr 0 1 ? ? ? pin function p34 input pin p34 output pin * 1 sck0 output pin * 1 sck0 output pin * 1 sck0 input pin irq4 interrupt input pin * 2 notes: 1. when p34odr = 1, the pin becomes an nmos open-drain output. 2. when this pin is used as an external interrupt input, it should not be used as an input/output pin with other functions.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 250 of 1108 rej09b0089-0700 pin selection method and pin functions p33/rxd1 the pin function is switched as shown below according to the combination of bit re in the sci1 scr, and bit p33ddr. re 0 1 p33ddr 0 1 ? pin function p33 input pin p33 output pin * rxd1 input pin note: * when p33odr = 1, the pin becomes an nmos open-drain output. p32/rxd0 the pin function is switched as shown below according to the combination of bit re in the sci0 scr, and bit p32ddr. re 0 1 p32ddr 0 1 ? pin function p32 input pin p32 output pin * rxd0 input pin note: * when p32odr = 1, the pin becomes an nmos open-drain output. p31/txd1 the pin function is switched as shown below according to the combination of bit te in the sci1 scr, and bit p31ddr. te 0 1 p31ddr 0 1 ? pin function p31 input pin p31 output pin * txd1 output pin note: * when p31odr = 1, the pin becomes an nmos open-drain output. p30/txd0 the pin function is switched as shown below according to the combination of bit te in the sci0 scr, and bit p30ddr. te 0 1 p30ddr 0 1 ? pin function p30 input pin p30 output pin * txd0 output pin note: * when p30odr = 1, the pin becomes an nmos open-drain output.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 251 of 1108 rej09b0089-0700 8.5 port 4 8.5.1 overview port 4 is an 8-bit input-only port. port 4 pins also function as a/d converter analog input pins (an0 to an7) and d/a converter analog output pins (da0 and da1). port 4 pin functions are the same in all operating modes. figure 8.4 shows the port 4 pin configuration. p47 (input) / an7 (input) / da1 (output) p46 (input) / an6 (input) / da0 (output) p45 (input) / an5 (input) p44 (input) / an4 (input) p43 (input) / an3 (input) p42 (input) / an2 (input) p41 (input) / an1 (input) p40 (input) / an0 (input) port 4 pins port 4 figure 8.4 port 4 pin functions
section 8 i/o ports rev.7.00 feb. 14, 2007 page 252 of 1108 rej09b0089-0700 8.5.2 register configuration table 8.8 shows the port 4 register configuration. port 4 is an input-only port, and does not have a data direction register or data register. table 8.8 port 4 register name abbreviation r/w initial value address * port 4 register port4 r undefined h'ff53 note: * lower 16 bits of the address. port 4 register (port4): the pin states are always read when a port 4 read is performed. bit : 7 6 5 4 3 2 1 0 p47 p46 p45 p44 p43 p42 p41 p40 initial value : ? * ? * ? * ? * ? * ? * ? * ? * r/w : r r r r r r r r note: * determined by state of pins p47 to p40. 8.5.3 pin functions port 4 pins also function as a/d converter an alog input pins (an0 to an7) and d/a converter analog output pins (da0 and da1).
section 8 i/o ports rev.7.00 feb. 14, 2007 page 253 of 1108 rej09b0089-0700 8.6 port a 8.6.1 overview port a is a 4-bit i/o port. port a pins also function as address bus outputs. the pin functions change according to the operating mode. port a has a built-in mos input pull-up function that can be controlled by software. figure 8.5 shows the port a pin configuration. pa3/ a19 pa2/ a18 pa1/ a17 pa0/ a16 note: * modes 6 and 7 are not available in the romless versions. port a pins a19 (output) a18 (output) a17 (output) a16 (output) pin functions in modes 4 and 5 pa3 (input)/a19 (output) pa2 (input)/a18 (output) pa1 (input)/a17 (output) pa0 (input)/a16 (output) pin functions in mode 6 * pa3 (i/o) pa2 (i/o) pa1 (i/o) pa0 (i/o) pin functions in mode 7 * port a figure 8.5 port a pin functions
section 8 i/o ports rev.7.00 feb. 14, 2007 page 254 of 1108 rej09b0089-0700 8.6.2 register configuration table 8.9 shows the port a register configuration. table 8.9 port a registers name abbreviation r/w initial value * 1 address * 2 port a data direction register paddr w h'0 h'feb9 port a data register padr r/w h'0 h'ff69 port a register porta r undefined h'ff59 port a mos pull-up control register papcr r/w h'0 h'ff70 port a open-drain control register paodr r/w h'0 h'ff77 notes: 1. value of bits 3 to 0. 2. lower 16 bits of the address. port a data direct ion register (paddr) bit : 7 6 5 4 3 2 1 0 ? ? ? ? pa3ddr pa2ddr pa1ddr pa0ddr initial value : undefined undefined undefined undefined 0 0 0 0 r/w : ? ? ? ? w w w w paddr is an 8-bit write-only register, the individual bits of which specify input or output for the pins of port a. paddr cannot be read; if it is, an undefined value will be read. bits 7 to 4 are reserved. paddr is initialized to h'0 (bits 3 to 0) by a reset and in hardware standby mode. it retains its prior state in software standby mode. the ope bit in sbycr is used to select whether the address output pins retain their output state or become high-impedance when a transition is made to software standby mode. ? modes 4 and 5 the corresponding port a pins are address outputs irrespective of the value of bits pa3ddr to pa0ddr. ? mode 6 * setting paddr bits to 1 makes the corresponding port a pins address outputs, while clearing the bits to 0 makes the pins input ports.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 255 of 1108 rej09b0089-0700 ? mode 7 * setting paddr bits to 1 makes the corresponding port a pins output ports, while clearing the bits to 0 makes the pins input ports. note: * modes 6 and 7 are not available in the romless versions. port a data register (padr) bit : 7 6 5 4 3 2 1 0 ? ? ? ? pa3dr pa2dr pa1dr pa0dr initial value : undefined undefined undefined undefined 0 0 0 0 r/w : ? ? ? ? r/w r/w r/w r/w padr is an 8-bit readable/writable register that stores output data for the port a pins (pa3 to pa0). bits 7 to 4 are reserved; they return an undetermined value if read, and cannot be modified. padr is initialized to h'0 (bits 3 to 0) by a reset, and in hardware standby mode. it retains its prior state in software standby mode. port a register (porta) bit : 7 6 5 4 3 2 1 0 ? ? ? ? pa3 pa2 pa1 pa0 initial value : undefined undefined undefined undefined ? * ? * ? * ? * r/w : ? ? ? ? r r r r note: * determined by state of pins pa3 to pa0. porta is an 8-bit read-only register that shows the pin states. it cannot be written to. writing of output data for the port a pins (pa3 to pa0) must always be performed on padr. bits 7 to 4 are reserved; they return an undetermined value if read, and cannot be modified. if a port a read is performed while paddr bits are set to 1, the padr values are read. if a port a read is performed while paddr bits are cleared to 0, the pin states are read. after a reset and in hardware standby mode, porta contents are determined by the pin states, as paddr and padr are initialized. porta retains its prior state in software standby mode.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 256 of 1108 rej09b0089-0700 port a mos pull-up control register (papcr) bit : 7 6 5 4 3 2 1 0 ? ? ? ? pa3pcr pa2pcr pa1pcr pa0pcr initial value : undefined undefined undefined undefined 0 0 0 0 r/w : ? ? ? ? r/w r/w r/w r/w papcr is an 8-bit readable/writable register that controls the mos input pull-up function incorporated into port a on an individual bit basis. bits 7 to 4 are reserved; they return an undetermined value if read, and cannot be modified. bits 3 to 0 are valid in modes 6 and 7 * , and all the bits are invalid in modes 4 and 5. when paddr bits are cleared to 0 (input port setting), setting the corresponding papcr bits to 1 turns on the mos input pull-up for the corresponding pins. papcr is initialized to h'0 (bits 3 to 0) by a reset, and in hardware standby mode. it retains its prior state in software standby mode. note: * modes 6 and 7 are not available in the romless versions. port a open drain control register (paodr) bit : 7 6 5 4 3 2 1 0 ? ? ? ? pa3odr pa2odr pa1odr pa0odr initial value : undefined undefined undefined undefined 0 0 0 0 r/w : ? ? ? ? r/w r/w r/w r/w paodr is an 8-bit readable/writable register that controls whether pmos is on or off for each port a pin (pa3 to pa0). bits 7 to 4 are reserved; they return an undetermined value if read, and cannot be modified. all bits are valid in mode 7. * setting paodr bits to 1 makes the corresponding port a pins nmos open-drain outputs, while clearing the bits to 0 makes the pins cmos outputs. paodr is initialized to h'0 (bits 3 to 0) by a reset, and in hardware standby mode. it retains its prior state in software standby mode. note: * modes 6 and 7 are not available in the romless versions.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 257 of 1108 rej09b0089-0700 8.6.3 pin functions modes 4 and 5: in modes 4 and 5, the lower 4 bits of port a are designated as address outputs automatically. port a pin functions in modes 4 and 5 are shown in figure 8.6. a19 a18 a17 a16 (output) (output) (output) (output) port a figure 8.6 port a pin functions (modes 4 and 5) mode 6 * : in mode 6 * , port a pins function as address outputs or input ports. input or output can be specified on an individual bit basis. setting paddr bits to 1 makes the corresponding port a pins address outputs, while clearing the bits to 0 makes the pins input ports. port a pin functions in mode 6 are shown in figure 8.7. a19 a18 a17 a16 pa3 pa2 pa1 pa0 (input) (input) (input) (input) (output) (output) (output) (output) port a when paddr = 1 when paddr = 0 figure 8.7 port a pin functions (mode 6) mode 7 * : in mode 7 * , port a pins function as i/o ports. input or output can be specified for each pin on an individual bit basis. setting paddr bits to 1 makes the corresponding port a pins output ports, while clearing the bits to 0 makes the pins input ports. port a pin functions in mode 7 are shown in figure 8.8.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 258 of 1108 rej09b0089-0700 pa3 pa2 pa1 pa0 (i/o) (i/o) (i/o) (i/o) port a figure 8.8 port a pin functions (mode 7) note: * modes 6 and 7 are not available in the romless versions. 8.6.4 mos input pull-up function port a has a built-in mos input pull-up function that can be controlled by software. this mos input pull-up function can be used in modes 6 and 7 * , and cannot be used in modes 4 and 5. mos input pull-up can be specified as on or off on an individual bit basis. when paddr bits are cleared to 0, setting the corresponding papcr bits to 1 turns on the mos input pull-up for that pins. the mos input pull-up function is in the off state after a reset, and in hardware standby mode. the prior state is retained in software standby mode. table 8.10 summarizes the mos input pull-up states. table 8.10 mos input pull-up states (port a) modes reset hardware standby mode software standby mode in other operations 6, 7 * pa3 to pa0 off off on/off on/off 4, 5 pa3 to pa0 off off legend: off: mos input pull-up is always off. on/off: on when paddr = 0 and papcr = 1; otherwise off. note: * modes 6 and 7 are not available in the romless versions.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 259 of 1108 rej09b0089-0700 8.7 port b 8.7.1 overview port b is an 8-bit i/o port. port b has an address bus output function, and the pin functions change according to the operating mode. port b has a built-in mos input pull-up function that can be controlled by software. figure 8.9 shows the port b pin configuration. pb7 / a15 pb6 / a14 pb5 / a13 pb4 / a12 pb3 / a11 pb2 / a10 pb1 / a9 pb0 / a8 pb7 (input) / a15 (output) pb6 (input) / a14 (output) pb5 (input) / a13 (output) pb4 (input) / a12 (output) pb3 (input) / a11 (output) pb2 (input) / a10 (output) pb1 (input) / a9 (output) pb0 (input) / a8 (output) port b pins pin functions in mode 6 * pin functions in mode 7 * a15 (output) a14 (output) a13 (output) a12 (output) a11 (output) a10 (output) a9 (output) a8 (output) pin functions in modes 4 and 5 pb7 (i/o) pb6 (i/o) pb5 (i/o) pb4 (i/o) pb3 (i/o) pb2 (i/o) pb1 (i/o) pb0 (i/o) port b note: * modes 6 and 7 are not available in the romless versions. figure 8.9 port b pin functions
section 8 i/o ports rev.7.00 feb. 14, 2007 page 260 of 1108 rej09b0089-0700 8.7.2 register configuration table 8.11 shows the port b register configuration. table 8.11 port b registers name abbreviation r/w initial value address * port b data direction register pbddr w h'00 h'feba port b data register pbdr r/w h'00 h'ff6a port b register portb r undefined h'ff5a port b mos pull-up control register pbpcr r/w h'00 h'ff71 note: * lower 16 bits of the address. port b data directio n register (pbddr) bit : 7 6 5 4 3 2 1 0 pb7ddr pb6ddr pb5ddr pb4ddr pb3ddr pb2ddr pb1ddr pb0ddr initial value : 0 0 0 0 0 0 0 0 r/w : w w w w w w w w pbddr is an 8-bit write-only register, the individual bits of which specify input or output for the pins of port b. pbddr cannot be read; if it is, an undefined value will be read. pbddr is initialized to h'00 by a reset, and in hardware standby mode. it retains its prior state in software standby mode. the ope bit in sbycr is used to select whether the address output pins retain their output state or become high-impedance when a transition is made to software standby mode. ? modes 4 and 5 the corresponding port b pins are address outputs irrespective of the value of the pbddr bits. ? mode 6 * setting pbddr bits to 1 makes the corresponding port b pins address outputs, while clearing the bits to 0 makes the pins input ports. ? mode 7 * setting pbddr bits to 1 makes the corresponding port b pins outputs, while clearing the bits to 0 makes the pins input ports. note: * modes 6 and 7 are not available in the romless versions.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 261 of 1108 rej09b0089-0700 port b data register (pbdr) bit : 7 6 5 4 3 2 1 0 pb7dr pb6dr pb5dr pb4dr pb3dr pb2dr pb1dr pb0dr initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w pbdr is an 8-bit readable/writable register that stores output data for the port b pins (pb7 to pb0). pbdr is initialized to h'00 by a reset, and in hardware standby mode. it retains its prior state in software standby mode. port b register (portb) bit : 7 6 5 4 3 2 1 0 pb7 pb6 pb5 pb4 pb3 pb2 pb1 pb0 initial value : ? * ? * ? * ? * ? * ? * ? * ? * r/w : r r r r r r r r note: * determined by state of pins pb7 to pb0. portb is an 8-bit read-only register that shows the pin states. it cannot be written to. writing of output data for the port b pins (pb7 to pb0) must always be performed on pbdr. if a port b read is performed while pbddr bits are set to 1, the pbdr values are read. if a port b read is performed while pbddr bits are cleared to 0, the pin states are read. after a reset and in hardware standby mode, portb contents are determined by the pin states, as pbddr and pbdr are initialized. portb retains its prior state in software standby mode.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 262 of 1108 rej09b0089-0700 port b mos pull-up control register (pbpcr) bit : 7 6 5 4 3 2 1 0 pb7pcr pb6pcr pb5pcr pb4pcr pb3pcr pb2pcr pb1pcr pb0pcr initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w pbpcr is an 8-bit readable/writable register that controls the mos input pull-up function incorporated into port b on an individual bit basis. when pbddr bits are cleared to 0 (input port setting) in mode 6 or 7, setting the corresponding pbpcr bits to 1 turns on the mos input pull-up for the corresponding pins. pbpcr is initialized to h'00 by a reset, and in hardware standby mode. it retains its prior state in software standby mode. 8.7.3 pin functions modes 4 and 5: in modes 4 and 5, port b pins are automatically designated as address outputs. port b pin functions in modes 4 and 5 are shown in figure 8.10. a15 (output) a14 (output) a13 (output) a12 (output) a11 (output) a10 (output) a9 (output) a8 (output) port b figure 8.10 port b pin functions (modes 4 and 5)
section 8 i/o ports rev.7.00 feb. 14, 2007 page 263 of 1108 rej09b0089-0700 mode 6 * : in mode 6, port b pins function as address outputs or input ports. input or output can be specified on an individual bit basis. setting pbddr bits to 1 makes the corresponding port b pins address outputs, while clearing the bits to 0 makes the pins input ports. port b pin functions in mode 6 are shown in figure 8.11 a15 (output) a14 (output) a13 (output) a12 (output) a11 (output) a10 (output) a9 (output) a8 (output) pb7 (input) pb6 (input) pb5 (input) pb4 (input) pb3 (input) pb2 (input) pb1 (input) pb0 (input) when pbddr = 1 when pbddr = 0 port b figure 8.11 port b pin functions (mode 6) mode 7 * : in mode 7, port b pins function as i/o ports. input or output can be specified for each pin on an individual bit basis. setting pbddr bits to 1 makes the corresponding port b pins output ports, while clearing the bits to 0 makes the pins input ports. port b pin functions in mode 7 are shown in figure 8.12. pb7 (i/o) pb6 (i/o) pb5 (i/o) pb4 (i/o) pb3 (i/o) pb2 (i/o) pb1 (i/o) pb0 (i/o) port b figure 8.12 port b pin functions (mode 7) note: * modes 6 and 7 are not available in the romless versions.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 264 of 1108 rej09b0089-0700 8.7.4 mos input pull-up function port b has a built-in mos input pull-up function that can be controlled by software. this mos input pull-up function can be used in modes 6 and 7, and can be specified as on or off on an individual bit basis. when pbddr bits are cleared to 0 in mode 6 or 7, setting the corresponding pbpcr bits to 1 turns on the mos input pull-up for that pins. the mos input pull-up function is in the off state after a reset, and in hardware standby mode. the prior state is retained in software standby mode. table 8.12 summarizes the mos input pull-up states. table 8.12 mos input pull-up states (port b) modes reset hardware standby mode software standby mode in other operations 4, 5 off off off off 6, 7 on/off on/off legend: off: mos input pull-up is always off. on/off: on when pbddr = 0 and pbpcr = 1; otherwise off.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 265 of 1108 rej09b0089-0700 8.8 port c 8.8.1 overview port c is an 8-bit i/o port. port c has an address bus output function, and the pin functions change according to the operating mode. port c has a built-in mos input pull-up function that can be controlled by software. figure 8.13 shows the port c pin configuration. pc7 / a7 pc6 / a6 pc5 / a5 pc4 / a4 pc3 / a3 pc2 / a2 pc1 / a1 pc0 / a0 port c pc7 (input) / a7 (output) pc6 (input) / a6 (output) pc5 (input) / a5 (output) pc4 (input) / a4 (output) pc3 (input) / a3 (output) pc2 (input) / a2 (output) pc1 (input) / a1 (output) pc0 (input) / a0 (output) port c pins pin functions in mode 6 * pin functions in mode 7 * a7 (output) a6 (output) a5 (output) a4 (output) a3 (output) a2 (output) a1 (output) a0 (output) pin functions in modes 4 and 5 pc7 (i/o) pc6 (i/o) pc5 (i/o) pc4 (i/o) pc3 (i/o) pc2 (i/o) pc1 (i/o) pc0 (i/o) note: * modes 6 and 7 are not available in the romless versions. figure 8.13 port c pin functions
section 8 i/o ports rev.7.00 feb. 14, 2007 page 266 of 1108 rej09b0089-0700 8.8.2 register configuration table 8.13 shows the port c register configuration. table 8.13 port c registers name abbreviation r/w initial value address * port c data direction register pcddr w h'00 h'febb port c data register pcdr r/w h'00 h'ff6b port c register portc r undefined h'ff5b port c mos pull-up control register pcpcr r/w h'00 h'ff72 note: * lower 16 bits of the address. port c data direct ion register (pcddr) bit : 7 6 5 4 3 2 1 0 pc7ddr pc6ddr pc5ddr pc4ddr pc3ddr pc2ddr pc1ddr pc0ddr initial value : 0 0 0 0 0 0 0 0 r/w : w w w w w w w w pcddr is an 8-bit write-only register, the individual bits of which specify input or output for the pins of port c. pcddr cannot be read; if it is, an undefined value will be read. pcddr is initialized to h'00 by a reset, and in hardware standby mode. it retains its prior state in software standby mode. the ope bit in sbycr is used to select whether the address output pins retain their output state or become high-impedance when a transition is made to software standby mode. ? modes 4 and 5 the corresponding port c pins are address outputs irrespective of the value of the pcddr bits. ? mode 6 * setting pcddr bits to 1 makes the corresponding port c pin address outputs, while clearing the bits to 0 makes the pins input ports. ? mode 7 * setting pcddr bits to 1 makes the corresponding port c pins an output ports, while clearing the bits to 0 makes the pins input ports. note: * modes 6 and 7 are not available in the romless versions.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 267 of 1108 rej09b0089-0700 port c data register (pcdr) bit : 7 6 5 4 3 2 1 0 pc7dr pc6dr pc5dr pc4dr pc3dr pc2dr pc1dr pc0dr initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w pcdr is an 8-bit readable/writable register that stores output data for the port c pins (pc7 to pc0). pcdr is initialized to h'00 by a reset, and in hardware standby mode. it retains its prior state in software standby mode. port c register (portc) bit : 7 6 5 4 3 2 1 0 pc7 pc6 pc5 pc4 pc3 pc2 pc1 pc0 initial value : ? * ? * ? * ? * ? * ? * ? * ? * r/w : r r r r r r r r note: * determined by state of pins pc7 to pc0. portc is an 8-bit read-only register that shows the pin states. it cannot be written to. writing of output data for the port c pins (pc7 to pc0) must always be performed on pcdr. if a port c read is performed while pcddr bits are set to 1, the pcdr values are read. if a port c read is performed while pcddr bits are cleared to 0, the pin states are read. after a reset and in hardware standby mode, portc contents are determined by the pin states, as pcddr and pcdr are initialized. portc retains its prior state in software standby mode.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 268 of 1108 rej09b0089-0700 port c mos pull-up control register (pcpcr) bit : 7 6 5 4 3 2 1 0 pc7pcr pc6pcr pc5pcr pc4pcr pc3pcr pc2pcr pc1pcr pc0pcr initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w pcpcr is an 8-bit readable/writable register that controls the mos input pull-up function incorporated into port c on an individual bit basis. when pcddr bits are cleared to 0 (input port setting) in mode 6 or 7, setting the corresponding pcpcr bits to 1 turns on the mos input pull-up for the corresponding pins. pcpcr is initialized to h'00 by a reset, and in hardware standby mode. it retains its prior state in software standby mode. 8.8.3 pin functions modes 4 and 5: in modes 4 and 5, port c pins are automatically designated as address outputs. port c pin functions in modes 4 and 5 are shown in figure 8.14. a7 (output) a6 (output) a5 (output) a4 (output) a3 (output) a2 (output) a1 (output) a0 (output) port c figure 8.14 port c pin functions (modes 4 and 5)
section 8 i/o ports rev.7.00 feb. 14, 2007 page 269 of 1108 rej09b0089-0700 mode 6 * : in mode 6, port c pins function as address outputs or input ports. input or output can be specified on an individual bit basis. setting pcddr bits to 1 makes the corresponding port c pins address outputs, while clearing the bits to 0 makes the pins an input ports. port c pin functions in mode 6 are shown in figure 8.15. a7 (output) a6 (output) a5 (output) a4 (output) a3 (output) a2 (output) a1 (output) a0 (output) port c pc7 (input) pc6 (input) pc5 (input) pc4 (input) pc3 (input) pc2 (input) pc1 (input) pc0 (input) when pcddr = 1 when pcddr = 0 figure 8.15 port c pin functions (mode 6) mode 7 * : in mode 7, port c pins function as i/o ports. input or output can be specified for each pin on an individual bit basis. setting pcddr bits to 1 makes the corresponding port c pins output ports, while clearing the bits to 0 makes the pins input ports. port c pin functions in mode 7 are shown in figure 8.16. pc7 pc6 pc5 pc4 pc3 pc2 pc1 pc0 port c (i/o) (i/o) (i/o) (i/o) (i/o) (i/o) (i/o) (i/o) figure 8.16 port c pin functions (mode 7) note: * modes 6 and 7 are not available in the romless versions.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 270 of 1108 rej09b0089-0700 8.8.4 mos input pull-up function port c has a built-in mos input pull-up function that can be controlled by software. this mos input pull-up function can be used in modes 6 and 7, and can be specified as on or off on an individual bit basis. when pcddr bits are cleared to 0 in mode 6 or 7, setting the corresponding pcpcr bits to 1 turns on the mos input pull-up for that pins. the mos input pull-up function is in the off state after a reset, and in hardware standby mode. the prior state is retained in software standby mode. table 8.14 summarizes the mos input pull-up states. table 8.14 mos input pull-up states (port c) modes reset hardware standby mode software standby mode in other operations 4, 5 off off off off 6, 7 on/off on/off legend: off: mos input pull-up is always off. on/off: on when p cddr = 0 and pcpcr = 1; otherwise off.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 271 of 1108 rej09b0089-0700 8.9 port d 8.9.1 overview port d is an 8-bit i/o port. port d has a data bus i/o function, and the pin functions change according to the operating mode. port d has a built-in mos input pull-up function that can be controlled by software. figure 8.17 shows the port d pin configuration. pd7 / d15 pd6 / d14 pd5 / d13 pd4 / d12 pd3 / d11 pd2 / d10 pd1 / d9 pd0 / d8 port d d15 (i/o) d14 (i/o) d13 (i/o) d12 (i/o) d11 (i/o) d10 (i/o) d9 (i/o) d8 (i/o) port d pins pin functions in modes 4 to 6 * pd7 (i/o) pd6 (i/o) pd5 (i/o) pd4 (i/o) pd3 (i/o) pd2 (i/o) pd1 (i/o) pd0 (i/o) pin functions in mode 7 * note: * modes 6 and 7 are not available in the romless versions. figure 8.17 port d pin functions
section 8 i/o ports rev.7.00 feb. 14, 2007 page 272 of 1108 rej09b0089-0700 8.9.2 register configuration table 8.15 shows the port d register configuration. table 8.15 port d registers name abbreviation r/w initial value address * port d data direction register pdddr w h'00 h'febc port d data register pddr r/w h'00 h'ff6c port d register portd r undefined h'ff5c port d mos pull-up control register pdpcr r/w h'00 h'ff73 note: * lower 16 bits of the address. port d data direct ion register (pdddr) bit : 7 6 5 4 3 2 1 0 pd7ddr pd6ddr pd5ddr pd4ddr pd3ddr pd2ddr pd1ddr pd0ddr initial value : 0 0 0 0 0 0 0 0 r/w : w w w w w w w w pdddr is an 8-bit write-only register, the individual bits of which specify input or output for the pins of port d. pdddr cannot be read; if it is, an undefined value will be read. pdddr is initialized to h'00 by a reset, and in hardware standby mode. it retains its prior state in software standby mode. ? modes 4 to 6 * the input/output direction specification by pdddr is ignored, and port d is automatically designated for data i/o. ? mode 7 * setting pdddr bits to 1 makes the corresponding port d pins output ports, while clearing the bits to 0 makes the pins input ports. note: * modes 6 and 7 are not available in the romless versions.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 273 of 1108 rej09b0089-0700 port d data register (pddr) bit : 7 6 5 4 3 2 1 0 pd7dr pd6dr pd5dr pd4dr pd3dr pd2dr pd1dr pd0dr initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w pddr is an 8-bit readable/writable register that stores output data for the port d pins (pd7 to pd0). pddr is initialized to h'00 by a reset, and in hardware standby mode. it retains its prior state in software standby mode. port d register (portd) bit : 7 6 5 4 3 2 1 0 pd7 pd6 pd5 pd4 pd3 pd2 pd1 pd0 initial value : ? * ? * ? * ? * ? * ? * ? * ? * r/w : r r r r r r r r note: * determined by state of pins pd7 to pd0. portd is an 8-bit read-only register that shows the pin states. it cannot be written to. writing of output data for the port d pins (pd7 to pd0) must always be performed on pddr. if a port d read is performed while pdddr bits are set to 1, the pddr values are read. if a port d read is performed while pdddr bits are cleared to 0, the pin states are read. after a reset and in hardware standby mode, portd contents are determined by the pin states, as pdddr and pddr are initialized. portd retains its prior state in software standby mode.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 274 of 1108 rej09b0089-0700 port d mos pull-up control register (pdpcr) bit : 7 6 5 4 3 2 1 0 pd7pcr pd6pcr pd5pcr pd4pcr pd3pcr pd2pcr pd1pcr pd0pcr initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w pdpcr is an 8-bit readable/writable register that controls the mos input pull-up function incorporated into port d on an individual bit basis. when pdddr bits are cleared to 0 (input port setting) in mode 7, setting the corresponding pdpcr bits to 1 turns on the mos input pull-up for the corresponding pins. pdpcr is initialized to h'00 by a reset, and in hardware standby mode. it retains its prior state in software standby mode.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 275 of 1108 rej09b0089-0700 8.9.3 pin functions modes 4 to 6 * : in modes 4 to 6, port d pins are automatically designated as data i/o pins. port d pin functions in modes 4 to 6 are shown in figure 8.18. d15 (i/o ) d14 (i/o ) d13 (i/o ) d12 (i/o ) d11 (i/o ) d10 (i/o ) d9 (i/o ) d8 (i/o ) port d figure 8.18 port d pin functions (modes 4 to 6) mode 7 * : in mode 7, port d pins function as i/o ports. input or output can be specified for each pin on an individual bit basis. setting pdddr bits to 1 makes the corresponding port d pins output ports, while clearing the bits to 0 makes the pins input ports. port d pin functions in mode 7 are shown in figure 8.19. pd7 (i/o) pd6 (i/o) pd5 (i/o) pd4 (i/o) pd3 (i/o) pd2 (i/o) pd1 (i/o) pd0 (i/o) port d figure 8.19 port d pin functions (mode 7) note: * modes 6 and 7 are not available in the romless versions.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 276 of 1108 rej09b0089-0700 8.9.4 mos input pull-up function port d has a built-in mos input pull-up function that can be controlled by software. this mos input pull-up function can be used in mode 7, and can be specified as on or off on an individual bit basis. when pdddr bits are cleared to 0 in mode 7, setting the corresponding pdpcr bits to 1 turns on the mos input pull-up for that pins. the mos input pull-up function is in the off state after a reset, and in hardware standby mode. the prior state is retained in software standby mode. table 8.16 summarizes the mos input pull-up states. table 8.16 mos input pull-up states (port d) modes reset hardware standby mode software standby mode in other operations 4 to 6 off off off off 7 on/off on/off legend: off: mos input pull-up is always off. on/off: on when p dddr = 0 and pdpcr = 1; otherwise off.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 277 of 1108 rej09b0089-0700 8.10 port e 8.10.1 overview port e is an 8-bit i/o port. port e has a data bus i/o function, and the pin functions change according to the operating mode and whether 8-bit or 16-bit bus mode is selected. port e has a built-in mos input pull-up function that can be controlled by software. figure 8.20 shows the port e pin configuration. pe7 / d7 pe6 / d6 pe5 / d5 pe4 / d4 pe3 / d3 pe2 / d2 pe1 / d1 pe0 / d0 pe7 (i/o) / d7 (i/o) pe6 (i/o) / d6 (i/o) pe5 (i/o) / d5 (i/o) pe4 (i/o) / d4 (i/o) pe3 (i/o) / d3 (i/o) pe2 (i/o) / d2 (i/o) pe1 (i/o) / d1 (i/o) pe0 (i/o) / d0 (i/o) port e pins pin functions in modes 4 to 6 * pin functions in mode 7 * pe7 (i/o) pe6 (i/o) pe5 (i/o) pe4 (i/o) pe3 (i/o) pe2 (i/o) pe1 (i/o) pe0 (i/o) port e note: * modes 6 and 7 are not available in the romless versions. figure 8.20 port e pin functions
section 8 i/o ports rev.7.00 feb. 14, 2007 page 278 of 1108 rej09b0089-0700 8.10.2 register configuration table 8.17 shows the port e register configuration. table 8.17 port e registers name abbreviation r/w initial value address * port e data direction register peddr w h'00 h'febd port e data register pedr r/w h'00 h'ff6d port e register porte r undefined h'ff5d port e mos pull-up control register pepcr r/w h'00 h'ff74 note: * lower 16 bits of the address. port e data directio n register (peddr) bit : 7 6 5 4 3 2 1 0 pe7ddr pe6ddr pe5ddr pe4ddr pe3ddr pe2ddr pe1ddr pe0ddr initial value : 0 0 0 0 0 0 0 0 r/w : w w w w w w w w peddr is an 8-bit write-only register, the individual bits of which specify input or output for the pins of port e. peddr cannot be read; if it is, an undefined value will be read. peddr is initialized to h'00 by a reset, and in hardware standby mode. it retains its prior state in software standby mode. ? modes 4 to 6 * when 8-bit bus mode has been selected, port e pins function as i/o ports. setting a peddr bit to 1 makes the corresponding port e pin an output port, while clearing the bit to 0 makes the pin an input port. when 16-bit bus mode has been selected, the input/output direction specification by peddr is ignored, and port e is designated for data i/o. for details of 8-bit and 16-bit bus modes, see section 6, bus controller. ? mode 7 * setting peddr bits to 1 makes the corresponding port e pins output ports, while clearing the bits to 0 makes the pins input ports. note: * modes 6 and 7 are not available in the romless versions.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 279 of 1108 rej09b0089-0700 port e data register (pedr) bit : 7 6 5 4 3 2 1 0 pe7dr pe6dr pe5dr pe4dr pe3dr pe2dr pe1dr pe0dr initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w pedr is an 8-bit readable/writable register that stores output data for the port e pins (pe7 to pe0). pedr is initialized to h'00 by a reset, and in hardware standby mode. it retains its prior state in software standby mode. port e register (porte) bit : 7 6 5 4 3 2 1 0 pe7 pe6 pe5 pe4 pe3 pe2 pe1 pe0 initial value : ? * ? * ? * ? * ? * ? * ? * ? * r/w : r r r r r r r r note: * determined by state of pins pe7 to pe0. porte is an 8-bit read-only register that shows the pin states. it cannot be written to. writing of output data for the port e pins (pe7 to pe0) must always be performed on pedr. if a port e read is performed while peddr bits are set to 1, the pedr values are read. if a port e read is performed while peddr bits are cleared to 0, the pin states are read. after a reset and in hardware standby mode, porte contents are determined by the pin states, as peddr and pedr are initialized. porte retains its prior state in software standby mode.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 280 of 1108 rej09b0089-0700 port e mos pull-up co ntrol register (pepcr) bit : 7 6 5 4 3 2 1 0 pe7pcr pe6pcr pe5pcr pe4pcr pe3pcr pe2pcr pe1pcr pe0pcr initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w pepcr is an 8-bit readable/writable register that controls the mos input pull-up function incorporated into port e on an individual bit basis. when peddr bits are cleared to 0 (input port setting) in mode 4, 5, or 6 with 8-bit bus mode selected, or in mode 7, setting the corresponding pepcr bits to 1 turns on the mos input pull-up for the corresponding pins. pepcr is initialized to h'00 by a reset, and in hardware standby mode. it retains its prior state in software standby mode. 8.10.3 pin functions modes 4 to 6 * : in modes 4 to 6, when 8-bit access is designated and 8-bit bus mode is selected, port e pins are automatically designated as i/o ports. setting peddr bits to 1 makes the corresponding port e pins output ports, while clearing the bits to 0 makes the pins input ports. when 16-bit bus mode is selected, the input/output direction specification by peddr is ignored, and port e is designated for data i/o. port e pin functions in modes 4 to 6 are shown in figure 8.21.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 281 of 1108 rej09b0089-0700 pe7 (i/o) pe6 (i/o) pe5 (i/o) pe4 (i/o) pe3 (i/o) pe2 (i/o) pe1 (i/o) pe0 (i/o) port e d7 (i/o) d6 (i/o) d5 (i/o) d4 (i/o) d3 (i/o) d2 (i/o) d1 (i/o) d0 (i/o) 8-bit bus mode 16-bit bus mod e figure 8.21 port e pin functions (modes 4 to 6) mode 7 * : in mode 7, port e pins function as i/o ports. input or output can be specified for each pin on a bit-by-bit basis. setting peddr bits to 1 makes the corresponding port e pins output ports, while clearing the bits to 0 makes the pins input ports. port e pin functions in mode 7 are shown in figure 8.22. pe7 (i/o) pe6 (i/o) pe5 (i/o) pe4 (i/o) pe3 (i/o) pe2 (i/o) pe1 (i/o) pe0 (i/o) port e figure 8.22 port e pin functions (mode 7) note: * modes 6 and 7 are not available in the romless versions.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 282 of 1108 rej09b0089-0700 8.10.4 mos input pull-up function port e has a built-in mos input pull-up function that can be controlled by software. this mos input pull-up function can be used in modes 4, 5, and 6 when 8-bit bus mode is selected, or in mode 7, and can be specified as on or off on an individual bit basis. when peddr bits are cleared to 0 in mode 4, 5, or 6 when 8-bit bus mode is selected, or in mode 7, setting the corresponding pepcr bits to 1 turns on the mos input pull-up for that pins. the mos input pull-up function is in the off state after a reset, and in hardware standby mode. the prior state is retained in software standby mode. table 8.18 summarizes the mos input pull-up states. table 8.18 mos input pull-up states (port e) modes reset hardware standby mode software standby mode in other operations 7 off off on/off on/off 4 to 6 8-bit bus 16-bit bus off off legend: off: mos input pull-up is always off. on/off: on when peddr = 0 and pepcr = 1; otherwise off.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 283 of 1108 rej09b0089-0700 8.11 port f 8.11.1 overview port f is an 8-bit i/o port. port f pins also function as bus control signal input/output pins ( as , rd , hwr , lwr , wait , breq , back , breqo , cs4 , and cs5 ), the system clock ( ) output pin and interrupt input pins ( irq0 to irq3 ). the interrupt input pins ( irq0 to irq3 ) are schmitt-triggered inputs. figure 8.23 shows the port f pin configuration. pf7/ pf6/ as pf5/ rd pf4/ hwr pf3/ lwr / irq3 pf2/ wait / irq2 / breqo pf1/ back / irq1 / cs5 pf0/ breq / irq0 / cs4 port f note: * modes 6 and 7 are not available in the romless versions. pf7 (input)/ (output) pf6 (i/o)/ as (output) rd (output) hwr (output) pf3 (i/o)/ lwr (output)/ irq3 (input) pf2 (i/o)/ wait (input)/ irq2 (input)/ breqo (output) pf1 (i/o)/ back (output)/ irq1 (input)/ cs5 (output) pf0 (i/o)/ breq (input)/ irq0 (input)/ cs4 (output) port f pins pin functions in modes 4 to 6 * pf7 (input)/ (output) pf6 (i/o) pf5 (i/o) pf4 (i/o) pf3 (i/o)/ irq3 (input) pf2 (i/o)/ irq2 (input) pf1 (i/o)/ irq1 (input) pf0 (i/o)/ irq0 (input) pin functions in mode 7 * figure 8.23 port f pin functions
section 8 i/o ports rev.7.00 feb. 14, 2007 page 284 of 1108 rej09b0089-0700 8.11.2 register configuration table 8.19 shows the port f register configuration. table 8.19 port f registers name abbreviation r/w initial value address * 1 port f data direction register pfddr w h'80/h'00 * 2 h'febe port f data register pfdr r/w h'00 h'ff6e port f register portf r undefined h'ff5e bus control register l bcrl r/w h'3c h'fed5 system control register syscr r/w h'01 h'ff39 port function control register 1 pfcr1 r/w h'0f h'ff45 port function control register 2 pfcr2 r/w h'30 h'ffac notes: 1. lower 16 bits of the address. 2. initial value depends on the mode. port f data directio n register (pfddr) bit : 7 6 5 4 3 2 1 0 pf7ddr pf6ddr pf5ddr pf4ddr pf3ddr pf2ddr pf1ddr pf0ddr modes 4 to 6 * initial value : 1 0 0 0 0 0 0 0 r/w : w w w w w w w w mode 7 * initial value : 0 0 0 0 0 0 0 0 r/w : w w w w w w w w pfddr is an 8-bit write-only register, the individual bits of which specify input or output for the pins of port f. pfddr cannot be read; if it is, an undefined value will be read. pfddr is initialized by a reset, and in hardware standby mode, to h'80 in modes 4 to 6 * , and to h'00 in mode 7 * . it retains its prior state in software standby mode. the ope bit in sbycr is used to select whether the bus control output pi ns retain their output state or become high- impedance when a transition is made to software standby mode. note: * modes 6 and 7 are not available in the romless versions.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 285 of 1108 rej09b0089-0700 port f data register (pfdr) bit : 7 6 5 4 3 2 1 0 pf7dr pf6dr pf5dr pf4dr pf3dr pf2dr pf1dr pf0dr initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w pfdr is an 8-bit readable/writable register that st ores output data for the port f pins (pf7 to pf0). pfdr is initialized to h'00 by a reset, and in hardware standby mode. it retains its prior state in software standby mode. port f register (portf) bit : 7 6 5 4 3 2 1 0 pf7 pf6 pf5 pf4 pf3 pf2 pf1 pf0 initial value : ? * ? * ? * ? * ? * ? * ? * ? * r/w : r r r r r r r r note: * determined by state of pins pf7 to pf0. portf is an 8-bit read-only register that shows the pin states, and cannot be modified. writing of output data for the port f pins (pf7 to pf0) must always be performed on pfdr. if a port f read is performed while pfddr bits are set to 1, the pfdr values are read. if a port f read is performed while pfddr bits are cleared to 0, the pin states are read. after a reset and in hardware standby mode, portf contents are determined by the pin states, as pfddr and pfdr are initialized. portf retains its prior state in software standby mode. port function control register 1 (pfcr1) bit : 7 6 5 4 3 2 1 0 css17 css36 pf1cs5s pf0cs4s a23e a22e a21e a20e initial value : 0 0 0 0 1 1 1 1 r/w : r/w r/w r/w r/w r/w r/w r/w r/w pfcr1 is an 8-bit readable/writable register that performs i/o port control. pfcr1 is initialized to h'0f by a reset, and in hardware standby mode.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 286 of 1108 rej09b0089-0700 bit 7?cs17 select (css17): selects whether cs1 or cs7 is output from the pg3 pin. for details, see section 8.12, port g. bit 6?cs36 select (css36): selects whether cs3 or cs6 is output from the pg1 pin. for details, see section 8.12, port g. bit 5?port f1 chip sel ect 5 select (pf1cs5s): selects enabling or disabling of cs5 output. this bit is valid in modes 4 to 6. bit 5 pf1cs5s description 0 pf1 is the pf1/ back / irq1 pin (initial value) 1 pf1 is the pf1/ back / irq1 / cs5 pin. cs5 output is enabled when brle = 0, cs25e = 1, and pf1ddr = 1 bit 4?port f0 chip sel ect 4 select (pf0cs4s): selects enabling or disabling of cs4 output. this bit is valid in modes 4 to 6. bit 4 pf0cs4s description 0 pf0 is the pf0/ breq / irq0 pin (initial value) 1 pf0 is the pf0/ breq / irq0 / cs4 pin. cs4 output is enabled when brle = 0, cs25e = 1, and pf0ddr = 1 bit 3?address 23 enable (a23e): enables or disables address output 23 (a23). for details, see section 8.2, port 1. bit 2?address 22 enable (a22e): enables or disables address output 22 (a22). for details, see section 8.2, port 1. bit 1?address 21 enable (a21e): enables or disables address output 21 (a21). for details, see section 8.2, port 1. bit 0?address 20 enable (a20e): enables or disables address output 20 (a20). for details, see section 8.2, port 1.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 287 of 1108 rej09b0089-0700 port function control register 2 (pfcr2) bit : 7 6 5 4 3 2 1 0 ? ? cs167e cs25e asod ? ? ? initial value : 0 0 1 1 0 0 0 0 r/w : r/w r/w r/w r/w r/w r r r pfcr2 is an 8-bit readable/writable register that performs i/o port control. pfcr2 is initialized to h'30 by a reset, and in hardware standby mode. bits 7 and 6?reserved: only 0 should be written to these bits. bit 5?cs167 enable (cs167e): enables or disables cs1 , cs6 , and cs7 output. for details, see section 8.12, port g. bit 4?cs25 enable (cs25e): enables or disables cs2 , cs3 , cs4 , and cs5 output. change the cs25e setting only when the ddr bits are cleared to 0. this bit is valid in modes 4 to 6. bit 4 cs25e description 0 cs2 , cs3 , cs4 , and cs5 output disabled (can be used as i/o ports) 1 cs2 , cs3 , cs4 , and cs5 output enabled (initial value) bit 3?as output disable (asod): enables or disables as output. this bit is valid in modes 4 to 6. bit 3 asod description 0 pf6 is used as as output pin (initial value) 1 pf6 is designated as i/o port, and does not function as as output pin bits 2 to 0?reserved: when read, these bits are always read as 0.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 288 of 1108 rej09b0089-0700 system control register (syscr) bit : 7 6 5 4 3 2 1 0 ? ? intm1 intm0 nmieg lwrod ? rame initial value : 0 0 0 0 0 0 0 1 r/w : r/w ? r/w r/w r/w r/w r/w r/w bit 2?lwr output disable (lwrod): enables or disables lwr output. this bit is valid in modes 4 to 6. bit 2 lwrod description 0 pf3 is designated as lwr output pin (initial value) 1 pf3 is designated as i/o port, and does not function as lwr output pin bus control register l (bcrl) bit : 7 6 5 4 3 2 1 0 brle breqoe eae ? ? ? ? waite initial value : 0 0 1 1 1 1 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w bcrl is an 8-bit readable/writable register that performs selection of the external bus-released state protocol, selection of the area partition unit, and enabling or disabling of wait pin input. bcrl is initialized to h'3c by a reset, and in hardware standby mode. it is not initialized in software standby mode. bit 7?bus release enable (brle): enables or disables external bus release. bit 7 brle description 0 external bus release disabled. breq , back , and breqo pins can be used as i/o ports (initial value) 1 external bus release enabled
section 8 i/o ports rev.7.00 feb. 14, 2007 page 289 of 1108 rej09b0089-0700 bit 6?breqo pin enable (breqoe): outputs a signal that requests the external bus master to drop the bus request signal ( breq ) in the external bus-released state, or when an internal bus master performs an external space access. bit 6 breqoe description 0 breqo output disabled. breqo pin can be used as i/o port (initial value) 1 breqo output enabled bit 0?wait pin enable (waite): selects enabling or disabling of wait input by the wait pin. bit 0 waite description 0 wait input by wait pin disabled. wait pin can be used as i/o port (initial value) 1 wait input by wait pin enabled
section 8 i/o ports rev.7.00 feb. 14, 2007 page 290 of 1108 rej09b0089-0700 8.11.3 pin functions port f pins also function as bus control signal input/output pins ( as , rd , hwr , lwr , wait , breq , back , breqo , cs4 , and cs5 ) the system clock ( ) output pin and interrupt input pins ( irq0 to irq3 ). the pin functions differ between modes 4 to 6 * 1 , and mode 7 * 1 . port f pin functions are shown in table 8.20. table 8.20 port f pin functions pin selection method and pin functions pf7/ the pin function is switched as shown below according to bit pf7ddr. pf7ddr 0 1 pin function pf7 input pin output pin pf6/ as the pin function is switched as shown below according to the operating mode, and bit pf6ddr, and bit asod in pfcr2. operating mode modes 4 to 6 * 1 mode 7 * 1 asod 0 1 ? pf6ddr ? 0 1 0 1 pin function as output pin pf6 input pin pf6 output pin pf6 input pin pf6 output pin pf5/ rd the pin function is switched as shown below according to the operating mode and bit pf5ddr. operating mode modes 4 to 6 * 1 mode 7 * 1 pf5ddr ? 0 1 pin function rd output pin pf5 input pin pf5 output pin pf4/ hwr the pin function is switched as shown below according to the operating mode and bit pf4ddr. operating mode modes 4 to 6 * 1 mode 7 * 1 pf4ddr ? 0 1 pin function hwr output pin pf4 input pin pf4 output pin
section 8 i/o ports rev.7.00 feb. 14, 2007 page 291 of 1108 rej09b0089-0700 pin selection method and pin functions pf3/ lwr / irq3 the pin function is switched as shown below according to the operating mode, and bit pf3ddr, and bit lwrod in syscr. operating mode modes 4 to 6 * 1 mode 7 * 1 lwrod 0 1 * 3 ? pf3ddr ? 0 1 0 1 pin function lwr output pin pf3 input pin pf3 output pin pf3 input pin pf3 output pin irq3 interrupt input pin * 2 pf2/ wait / irq2 / breqo the pin function is switched as shown below according to the operating mode, and waite bit, breqoe bit in bcrl and pf2ddr bit. operating mode modes 4 to 6 * 1 mode 7 * 1 breqoe 0 1 ? waite 0 1 0 1 ? pf2ddr 0 1 0 1 ? ? 0 1 pin function pf2 input pin pf2 output pin wait input pin setting prohi- bited breqo output pin setting prohi- bited pf2 input pin pf2 output pin irq2 interrupt input pin * 2
section 8 i/o ports rev.7.00 feb. 14, 2007 page 292 of 1108 rej09b0089-0700 pin selection method and pin functions pf1/ back / irq1 / cs5 the pin function is switched as shown below according to the operating mode, and the brle bit in bcrl, pf1cs5s bit in pfcr1, and cs25e bit in pfcr2 and pf1ddr bit. operating mode modes 4 to 6 * 1 mode 7 * 1 brle 0 1 ? pf1ddr 0 1 ? 0 1 cs25e ? 0 1 ? ? ? pf1cs5s ? ? 0 1 ? ? ? pin function pf1 input pin pf1 output pin cs5 output pin back output pin pf1 input pin pf1 output pin irq1 interrupt input pin * 2 pf0/ breq / irq0 / cs4 the pin function is switched as shown below according to the operating mode, and the brle bit in bcrl and pf0cs4s bit in pfcr1 and cs25e bit in pfcr2 and pf0ddr bit. operating mode modes 4 to 6 * 1 mode 7 * 1 brle 0 1 ? pf0ddr 0 1 ? 0 1 cs25e ? 0 1 ? ? ? pf0cs4s ? ? 0 1 ? ? ? pin function pf0 input pin pf0 output pin cs4 output pin breq output pin pf0 input pin pf0 output pin irq0 interrupt input pin * 2 notes: 1. modes 6 and 7 are not available in the romless versions. 2. when this pin is used as an external interrupt input, the pin function should be set as a port (pfn) input pin. 3. valid only in 8-bit-bus mode.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 293 of 1108 rej09b0089-0700 8.12 port g 8.12.1 overview port g is a 5-bit i/o port. port g pins also function as bus control signal output pins ( cs0 to cs3 , cs6 , cs7 ). the a/d converter input pin ( adtrg ), and interrupt input pins ( irq6 , irq7 ). the interrupt input pins ( irq6 , irq7 ) are schmitt-triggered inputs. figure 8.24 shows the port g pin configuration. pg4/ cs0 pg3/ cs1 / cs7 pg2/ cs2 pg1/ cs3 / irq7 / cs6 pg0/ adtrg / irq6 pg4 pg3 pg2 pg1 pg0 note: * modes 6 and 7 are not available in the romless versions. (i/o) (i/o) (i/o) (i/o)/ irq7 (input) (i/o)/ port g pins pin functions in mode 7 * pin functions in modes 4 to 6 * pg4 pg3 pg2 pg1 pg0 (i/o)/ (i/o)/ (i/o)/ (i/o)/ (i/o)/ cs0 cs1 cs2 cs3 (output) (output)/ (output) (output)/ irq7 (input)/ cs7 (output) cs6 (output) port g adtrg (input)/ irq6 (input) adtrg (input)/ irq6 (input) figure 8.24 port g pin functions
section 8 i/o ports rev.7.00 feb. 14, 2007 page 294 of 1108 rej09b0089-0700 8.12.2 register configuration table 8.21 shows the port g register configuration. table 8.21 port g registers name abbreviation r/w initial value * 1 address * 2 port g data direction register pgddr w h'10/h'00 * 3 h'febf port g data register pgdr r/w h'00 h'ff6f port g register portg r undefined h'ff5f port function control register 1 pfcr1 r/w h'0f h'ff45 port function control register 2 pfcr2 r/w h'30 h'ffac notes: 1. value of bits 4 to 0. 2. lower 16 bits of the address. 3. initial value depends on the mode. port g data directio n register (pgddr) bit : 7 6 5 4 3 2 1 0 ? ? ? pg4ddr pg3ddr pg2ddr pg1ddr pg0ddr modes 4 and 5 initial value : undefined undefined undefined 1 0 0 0 0 r/w : ? ? ? w w w w w modes 6 and 7 * initial value : undefined undefined undefined 0 0 0 0 0 r/w : ? ? ? w w w w w pgddr is an 8-bit write-only register, the individual bits of which specify input or output for the pins of port g. pgddr cannot be read, and bits 7 to 5 are reserved. if pgddr is read, an undefined value will be read. the pgddr is initialized by a reset and in hardware standby mode, to h'10 (bits 4 to 0) in modes 4 and 5, and to h'00 (bits 4 to 0) in modes 6 and 7 * . it retains its prior state in software standby mode. the ope bit in sbycr is used to select whether the bus control output pins retain their output state or become high-impedance when a transition is made to software standby mode. note: * modes 6 and 7 are not available in the romless versions.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 295 of 1108 rej09b0089-0700 port g data register (pgdr) bit : 7 6 5 4 3 2 1 0 ? ? ? pg4dr pg3dr pg2dr pg1dr pg0dr initial value : undefined undefined undefined 0 0 0 0 0 r/w : ? ? ? r/w r/w r/w r/w r/w pgdr is an 8-bit readable/writable register that stores output data for the port g pins (pg4 to pg0). bits 7 to 5 are reserved; they return an undetermined value if read, and cannot be modified. pgdr is initialized to h'00 (bits 4 to 0) by a rese t, and in hardware standby mode. it retains its prior state in software standby mode. port g register (portg) bit : 7 6 5 4 3 2 1 0 ? ? ? pg4 pg 3 pg2 pg1 pg0 initial value : undefined undefined undefined ? * ? * ? * ? * ? * r/w : ? ? ? r r r r r note: * determined by state of pins pg4 to pg0. portg is an 8-bit read-only register that shows the pin states. it cannot be written to. writing of output data for the port g pins (pg4 to pg0) must always be performed on pgdr. bits 7 to 5 are reserved; they return an undetermined value if read, and cannot be modified. if a port g read is performed while pgddr bits are set to 1, the pgdr values are read. if a port g read is performed while pgddr bits are cleared to 0, the pin states are read. after a reset and in hardware standby mode, portg contents are determined by the pin states, as pgddr and pgdr are initialized. portg retains its prior state in software standby mode.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 296 of 1108 rej09b0089-0700 port function control register 1 (pfcr1) bit : 7 6 5 4 3 2 1 0 css17 css36 pf1cs5s pf0cs4s a23e a22e a21e a20e initial value : 0 0 0 0 1 1 1 1 r/w : r/w r/w r/w r/w r/w r/w r/w r/w pfcr1 is an 8-bit readable/writable register that performs i/o port control. pfcr1 is initialized to h'0f by a reset, and in hardware standby mode. bit 7?cs17 select (css17): selects whether cs1 or cs7 is output from the pg3 pin. change the css17 bit setting only when the corresponding ddr bit is 0. this bit is valid in modes 4 to 6. bit 7 css17 description 0 pg3 is the pg3/ cs1 pin. cs1 output is enabled when cs167e = 1 and pg3ddr = 1 (initial value) 1 pg3 is the pg3/ cs7 pin. cs7 output is enabled when cs167e = 1 and pg3ddr = 1 bit 6?cs36 select (css36): selects whether cs3 or cs6 is output from the pg1 pin. change the css36 bit setting only when the corresponding ddr bit is 0. this bit is valid in modes 4 to 6. bit 6 css36 description 0 pg1 is the pg1/ irq7 / cs3 pin. cs3 output is enabled when cs25e = 1 and pg1ddr = 1 (initial value) 1 pg1 is the pg1/ irq7 / cs6 pin. cs6 output is enabled when cs167e = 1 and pg1ddr = 1 bit 5?port f1 chip sel ect 5 select (pf1cs5s): enables or disables cs5 output. for details, see section 8.11, port f. bit 4?port f0 chip sel ect 4 select (pf0cs4s): enables or disables cs4 output. for details, see section 8.11, port f. bit 3?address 23 enable (a23e): enables or disables address output 23 (a23). for details, see section 8.2, port 1. bit 2?address 22 enable (a22e): enables or disables address output 22 (a22). for details, see section 8.2, port 1.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 297 of 1108 rej09b0089-0700 bit 1?address 21 enable (a21e): enables or disables address output 21 (a21). for details, see section 8.2, port 1. bit 0?address 20 enable (a20e): enables or disables address output 20 (a20). for details, see section 8.2, port 1. port function control register 2 (pfcr2) bit : 7 6 5 4 3 2 1 0 ? ? cs167e cs25e asod ? ? ? initial value : 0 0 1 1 0 0 0 0 r/w : r/w r/w r/w r/w r/w r r r pfcr2 is an 8-bit readable/writable register that performs i/o port control. pfcr2 is initialized to h'30 by a reset, and in hardware standby mode. this bit is valid in modes 4 to 6. bits 7 and 6?reserved: only 0 should be written to these bits. bit 5?cs167 enable (cs167e): enables or disables cs1 , cs6 , and cs7 output. change the cs167e setting only when the ddr bits are cleared to 0. bit 5 cs167e description 0 cs1 , cs6 , and cs7 output disabled (can be used as i/o ports) 1 cs1 , cs6 , and cs7 output enabled (initial value) bit 4?cs25 enable (cs25e): enables or disables cs2 , cs3 , cs4 , and cs5 output. change the cs25e setting only when the ddr bits are cleared to 0. this bit is valid in modes 4 to 6. bit 4 cs25e description 0 cs2 , cs3 , cs4 , and cs5 output disabled (can be used as i/o ports) 1 cs2 , cs3 , cs4 , and cs5 output enabled (initial value) bit 3?as output disable (asod): enables or disables as output. this bit is valid in modes 4 to 6. for details, see section 8.11, port f. bits 2 to 0?reserved: when read, these bits are always read as 0.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 298 of 1108 rej09b0089-0700 8.12.3 pin functions port g pins also function as bus control signal output pins ( cs0 to cs3 , cs6 , cs7 ) the a/d converter input pin ( adtrg ), and interrupt input pins ( irq6 , irq7 ). the pin functions are different in mode 7 * 1 , and modes 4 to 6 * 1 . port g pin functions are shown in table 8.22. table 8.22 port g pin functions pin selection method and pin functions pg4/ cs0 the pin function is switched as shown below according to the operating mode and bit pg4ddr. operating mode modes 4 to 6 * 1 mode 7 * 1 pg4ddr 0 1 0 1 pin function pg4 input pin cs0 output pin pg4 input pin pg4 output pin pg3/ cs1 / cs7 the pin function is switched as shown below according to the operating mode and css17 bit in pfcr1, cs167e bit in pfcr2, and bit pg3ddr. operating mode modes 4 to 6 * 1 mode 7 * 1 pg3ddr 0 1 0 1 cs167e ? 0 1 ? ? css17 ? ? 0 1 ? ? pin function pg3 input pin pg3 output pin cs1 output pin cs7 output pin pg3 input pin pg3 output pin pg2/ cs2 the pin function is switched as shown below according to the operating mode and cs25e bit in pfcr2, and bit pg2ddr. operating mode modes 4 to 6 * 1 mode 7 * 1 pg2ddr 0 1 0 1 cs25e ? 0 1 ? ? pin function pg2 input pin pg2 output pin cs2 output pin pg2 input pin pg2 output pin
section 8 i/o ports rev.7.00 feb. 14, 2007 page 299 of 1108 rej09b0089-0700 pin selection method and pin functions pg1/ cs3 / cs6 / irq7 the pin function is switched as shown below according to the combination of operating mode and css36 bit in pfcr1, cs167e bit in pfcr2, cs25e bit and bit pg1ddr. operating mode modes 4 to 6 * 1 mode 7 * 1 pg1ddr 0 1 0 1 cs167e ? 0 1 ? ? cs25e ? 0 1 0 1 ? ? css36 ? ? 0 1 0 1 0 1 ? ? pin function pg1 input pin pg1 output pin cs3 output pin pg1 output pin cs6 output pin cs3 output pin cs6 output pin pg1 input pin pg1 output pin irq7 interrupt input pin * 2 pg0/ adtrg / irq6 the pin function is switched as shown below according to the combination of bits trgs1 and trgs0 (trigger select 1 and 0) in the a/d control register (adcr). pg0ddr 0 1 pin function pg0 input pg0 output adtrg input pin * 3 irq6 interrupt input pin * 2 notes: 1. modes 6 and 7 are not available in the romless versions. 2. when this pin is used as an external interrupt input, it should not be used as an input/output pin with other functions. 3. adtrg input when trgs1 = trgs0 = 1.
section 8 i/o ports rev.7.00 feb. 14, 2007 page 300 of 1108 rej09b0089-0700
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 301 of 1108 rej09b0089-0700 section 9 16-bit timer pulse unit (tpu) 9.1 overview the chip has an on-chip 16-bit timer pulse unit (tpu) that comprises six 16-bit timer channels. 9.1.1 features ? maximum 16-pulse input/output ? a total of 16 timer general registers (tgrs) are provided (four each for channels 0 and 3, and two each for channels 1, 2, 4, and 5), each of which can be set independently as an output compare/input capture register ? tgrc and tgrd for channels 0 and 3 can also be used as buffer registers ? selection of 8 counter input clocks for each channel ? the following operations can be set for each channel: ? waveform output at compare match: selection of 0, 1, or toggle output ? input capture function: selection of rising edge, falling edge, or both edge detection ? counter clear operation: counter clearing po ssible by compare match or input capture ? synchronous operation: multiple timer counters (tcnt) can be written to simultaneously ? simultaneous clearing by compare match and input capture possible ? register simultaneous input/output possible by counter synchronous operation ? pwm mode: any pwm output duty can be set ? maximum of 15-phase pwm output possible by combination with synchronous operation ? buffer operation settable for channels 0 and 3 ? input capture register double-buffering possible ? automatic rewriting of output compare register possible ? phase counting mode settable independently for each of channels 1, 2, 4, and 5 ? two-phase encoder pulse up/down-count possible ? cascaded operation ? channel 2 (channel 5) input clock operates as 32-bit counter by setting channel 1 (channel 4) overflow/underflow ? fast access via internal 16-bit bus ? fast access is possible via a 16-bit bus interface
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 302 of 1108 rej09b0089-0700 ? 26 interrupt sources ? for channels 0 and 3, four compare match/input capture dual-function interrupts and one overflow interrupt can be requested independently ? for channels 1, 2, 4, and 5, two compare match/input capture dual-function interrupts, one overflow interrupt, and one underflow interrupt can be requested independently ? automatic transfer of register data ? block transfer, 1-word data transfer, and 1-byte data transfer possible by data transfer controller (dtc) activation ? a/d converter conversion start trigger can be generated ? channel 0 to 5 compare match a/input capture a signals can be used as a/d converter conversion start trigger ? module stop mode can be set ? as the initial setting, tpu operation is halted. register access is enabled by exiting module stop mode
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 303 of 1108 rej09b0089-0700 table 9.1 lists the functions of the tpu. table 9.1 tpu functions item channel 0 channel 1 channel 2 channel 3 channel 4 channel 5 count clock /1 /4 /16 /64 tclka tclkb tclkc tclkd /1 /4 /16 /64 /256 tclka tclkb /1 /4 /16 /64 /1024 tclka tclkb tclkc /1 /4 /16 /64 /256 /1024 /4096 tclka /1 /4 /16 /64 /1024 tclka tclkc /1 /4 /16 /64 /256 tclka tclkc tclkd general registers tgr0a tgr0b tgr1a tgr1b tgr2a tgr2b tgr3a tgr3b tgr4a tgr4b tgr5a tgr5b general registers/ buffer registers tgr0c tgr0d ? ? tgr3c tgr3d ? ? i/o pins tioca0 tiocb0 tiocc0 tiocd0 tioca1 tiocb1 tioca2 tiocb2 tioca3 tiocb3 tiocc3 tiocd3 tioca4 tiocb4 tioca5 tiocb5 counter clear function tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture 0 output 1 output compare match output toggle output input capture function synchronous operation pwm mode phase counting mode ? ? buffer operation ? ? ? ?
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 304 of 1108 rej09b0089-0700 item channel 0 channel 1 channel 2 channel 3 channel 4 channel 5 dtc activation tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture a/d con- version start trigger tgr0a compare match or input capture tgr1a compare match or input capture tgr2a compare match or input capture tgr3a compare match or input capture tgr4a compare match or input capture tgr5a compare match or input capture interrupt sources 5 sources ? compare match or input capture 0a ? compare match or input capture 0b ? compare match or input capture 0c ? compare match or input capture 0d ? overflow 4 sources ? compare match or input capture 1a ? compare match or input capture 1b ? overflow ? underflow 4 sources ? compare match or input capture 2a ? compare match or input capture 2b ? overflow ? underflow 5 sources ? compare match or input capture 3a ? compare match or input capture 3b ? compare match or input capture 3c ? compare match or input capture 3d ? overflow 4 sources ? compare match or input capture 4a ? compare match or input capture 4b ? overflow ? underflow 4 sources ? compare match or input capture 5a ? compare match or input capture 5b ? overflow ? underflow legend: : possible ?: not possible
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 305 of 1108 rej09b0089-0700 9.1.2 block diagram figure 9.1 shows a block diagram of the tpu. channel 3 tmdr tiorl tsr tcr tiorh tier tgra tcnt tgrb tgrc tgrd channel 4 tmdr tsr tcr tior tier tgra tcnt tgrb control logic tmdr tsr tcr tior tier tgra tcnt tgrb control logic for channels 3 to 5 tgra tcnt tgrb tgrc channel 1 tmdr tsr tcr tior tier tgra tcnt tgrb channel 0 tmdr tsr tcr tiorh tier control logic for channels 0 to 2 tgrd tsyr tstr input/output pins tioca3 tiocb3 tiocc3 tiocd3 tioca4 tiocb4 tioca5 tiocb5 clock input /1 /4 /16 /64 /256 /1024 /4096 tclka tclkb tclkc tclkd input/output pins tioca0 tiocb0 tiocc0 tiocd0 tioca1 tiocb1 tioca2 tiocb2 interrupt request signals channel 3: channel 4: channel 5: interrupt request signals channel 0: channel 1: channel 2: internal data bus a/d conversion start request signal tiorl module data bus tgi3a tgi3b tgi3c tgi3d tci3v tgi4a tgi4b tci4v tci4u tgi5a tgi5b tci5v tci5u tgi0a tgi0b tgi0c tgi0d tci0v tgi1a tgi1b tci1v tci1u tgi2a tgi2b tci2v tci2u channel 3: channel 4: channel 5: internal clock: external clock: channel 0: channel 1: channel 2: tmdr tsr tcr tior tier tgra tcnt tgrb channel 2 common channel 5 bus interface figure 9.1 block diagram of tpu
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 306 of 1108 rej09b0089-0700 9.1.3 pin configuration table 9.2 summarizes the tpu pins. table 9.2 tpu pins channel name symbol i/o function all clock input a tclka input external clock a input pin (channel 1 and 5 phase counting mode a phase input) clock input b tclkb input external clock b input pin (channel 1 and 5 phase counting mode b phase input) clock input c tclkc input external clock c input pin (channel 2 and 4 phase counting mode a phase input) clock input d tclkd input external clock d input pin (channel 2 and 4 phase counting mode b phase input) 0 input capture/out compare match a0 tioca0 i/o tgr0a input capture input/output compare output/pwm output pin input capture/out compare match b0 tiocb0 i/o tgr0b input capture input/output compare output/pwm output pin input capture/out compare match c0 tiocc0 i/o tgr0c input capture input/output compare output/pwm output pin input capture/out compare match d0 tiocd0 i/o tgr0d input capture input/output compare output/pwm output pin 1 input capture/out compare match a1 tioca1 i/o tgr1a input capture input/output compare output/pwm output pin input capture/out compare match b1 tiocb1 i/o tgr1b input capture input/output compare output/pwm output pin 2 input capture/out compare match a2 tioca2 i/o tgr2a input capture input/output compare output/pwm output pin input capture/out compare match b2 tiocb2 i/o tgr2b input capture input/output compare output/pwm output pin
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 307 of 1108 rej09b0089-0700 channel name symbol i/o function 3 input capture/out compare match a3 tioca3 i/o tgr3a input capture input/output compare output/pwm output pin input capture/out compare match b3 tiocb3 i/o tgr3b input capture input/output compare output/pwm output pin input capture/out compare match c3 tiocc3 i/o tgr3c input capture input/output compare output/pwm output pin input capture/out compare match d3 tiocd3 i/o tgr3d input capture input/output compare output/pwm output pin 4 input capture/out compare match a4 tioca4 i/o tgr4a input capture input/output compare output/pwm output pin input capture/out compare match b4 tiocb4 i/o tgr4b input capture input/output compare output/pwm output pin 5 input capture/out compare match a5 tioca5 i/o tgr5a input capture input/output compare output/pwm output pin input capture/out compare match b5 tiocb5 i/o tgr5b input capture input/output compare output/pwm output pin
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 308 of 1108 rej09b0089-0700 9.1.4 register configuration table 9.3 summarizes the tpu registers. table 9.3 tpu registers channel name abbreviation r/w initial value address * 1 0 timer control register 0 tcr0 r/w h'00 h'ffd0 timer mode register 0 tmdr0 r/w h'c0 h'ffd1 timer i/o control register 0h tior0h r/w h'00 h'ffd2 timer i/o control register 0l tior0l r/w h'00 h'ffd3 timer interrupt enable register 0 tier0 r/w h'40 h'ffd4 timer status register 0 tsr0 r/(w) * 2 h'c0 h'ffd5 timer counter 0 tcnt0 r/w h'0000 h'ffd6 timer general register 0a tgr0a r/w h'ffff h'ffd8 timer general register 0b tgr0b r/w h'ffff h'ffda timer general register 0c tgr0c r/w h'ffff h'ffdc timer general register 0d tgr0d r/w h'ffff h'ffde 1 timer control register 1 tcr1 r/w h'00 h'ffe0 timer mode register 1 tmdr1 r/w h'c0 h'ffe1 timer i/o control register 1 tior1 r/w h'00 h'ffe2 timer interrupt enable register 1 tier1 r/w h'40 h'ffe4 timer status register 1 tsr1 r/(w) * 2 h'c0 h'ffe5 timer counter 1 tcnt1 r/w h'0000 h'ffe6 timer general register 1a tgr1a r/w h'ffff h'ffe8 timer general register 1b tgr1b r/w h'ffff h'ffea 2 timer control register 2 tcr2 r/w h'00 h'fff0 timer mode register 2 tmdr2 r/w h'c0 h'fff1 timer i/o control register 2 tior2 r/w h'00 h'fff2 timer interrupt enable register 2 tier2 r/w h'40 h'fff4 timer status register 2 tsr2 r/(w) * 2 h'c0 h'fff5 timer counter 2 tcnt2 r/w h'0000 h'fff6 timer general register 2a tgr2a r/w h'ffff h'fff8 timer general register 2b tgr2b r/w h'ffff h'fffa
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 309 of 1108 rej09b0089-0700 channel name abbreviation r/w initial value address * 1 3 timer control register 3 tcr3 r/w h'00 h'fe80 timer mode register 3 tmdr3 r/w h'c0 h'fe81 timer i/o control register 3h tior3h r/w h'00 h'fe82 timer i/o control register 3l tior3l r/w h'00 h'fe83 timer interrupt enable register 3 tier3 r/w h'40 h'fe84 timer status register 3 tsr3 r/(w) * 2 h'c0 h'fe85 timer counter 3 tcnt3 r/w h'0000 h'fe86 timer general register 3a tgr3a r/w h'ffff h'fe88 timer general register 3b tgr3b r/w h'ffff h'fe8a timer general register 3c tgr3c r/w h'ffff h'fe8c timer general register 3d tgr3d r/w h'ffff h'fe8e 4 timer control register 4 tcr4 r/w h'00 h'fe90 timer mode register 4 tmdr4 r/w h'c0 h'fe91 timer i/o control register 4 tior4 r/w h'00 h'fe92 timer interrupt enable register 4 tier4 r/w h'40 h'fe94 timer status register 4 tsr4 r/(w) * 2 h'c0 h'fe95 timer counter 4 tcnt4 r/w h'0000 h'fe96 timer general register 4a tgr4a r/w h'ffff h'fe98 timer general register 4b tgr4b r/w h'ffff h'fe9a 5 timer control register 5 tcr5 r/w h'00 h'fea0 timer mode register 5 tmdr5 r/w h'c0 h'fea1 timer i/o control register 5 tior5 r/w h'00 h'fea2 timer interrupt enable register 5 tier5 r/w h'40 h'fea4 timer status register 5 tsr5 r/(w) * 2 h'c0 h'fea5 timer counter 5 tcnt5 r/w h'0000 h'fea6 timer general register 5a tgr5a r/w h'ffff h'fea8 timer general register 5b tgr5b r/w h'ffff h'feaa all timer start register tstr r/w h'00 h'ffc0 timer synchro register tsyr r/w h'00 h'ffc1 module stop control register mstpcr r/w h'3fff h'ff3c notes: 1. lower 16 bits of the address. 2. can only be written with 0 for flag clearing.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 310 of 1108 rej09b0089-0700 9.2 register descriptions 9.2.1 timer control registers (tcr) channel 0: tcr0 channel 3: tcr3 bit : 7 6 5 4 3 2 1 0 cclr2 cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w channel 1: tcr1 channel 2: tcr2 channel 4: tcr4 channel 5: tcr5 bit : 7 6 5 4 3 2 1 0 ? cclr1 cclr0 ckeg1 c keg0 tpsc2 tpsc1 tpsc0 initial value : 0 0 0 0 0 0 0 0 r/w : ? r/w r/w r/w r/w r/w r/w r/w the tcr registers are 8-bit registers that control the tcnt channels. the tpu has six tcr registers, one for each of channels 0 to 5. the tcr registers are initialized to h'00 by a reset and in hardware standby mode. tcr register settings should be made only when tcnt operation is stopped.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 311 of 1108 rej09b0089-0700 bits 7 to 5?counter clear 2 to 0 (cclr2 to cclr0): these bits select the tcnt counter clearing source. channel bit 7 cclr2 bit 6 cclr1 bit 5 cclr0 description 0, 3 0 0 0 tcnt clearing disabled (initial value) 1 tcnt cleared by tgra compare match/input capture 1 0 tcnt cleared by tgrb compare match/input capture 1 tcnt cleared by counter clearing for another channel performing synchronous clearing/ synchronous operation * 1 1 0 0 tcnt clearing disabled 1 tcnt cleared by tgrc compare match/input capture * 2 1 0 tcnt cleared by tgrd compare match/input capture * 2 1 tcnt cleared by counter clearing for another channel performing synchronous clearing/ synchronous operation * 1 channel bit 7 reserved * 3 bit 6 cclr1 bit 5 cclr0 description 1, 2, 4, 5 0 0 0 tcnt clearing disabled (initial value) 1 tcnt cleared by tgra compare match/input capture 1 0 tcnt cleared by tgrb compare match/input capture 1 tcnt cleared by counter clearing for another channel performing synchronous clearing/ synchronous operation * 1 notes: 1. synchronous operation setting is performed by setting the sync bit in tsyr to 1. 2. when tgrc or tgrd is used as a buffer register, tcnt is not cleared because the buffer register setting has priority, and compare match/input capture does not occur. 3. bit 7 is reserved in channels 1, 2, 4, and 5. it is always read as 0 and cannot be modified.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 312 of 1108 rej09b0089-0700 bits 4 and 3?clock edge 1 and 0 (ckeg1, ckeg0): these bits select the input clock edge. when the input clock is counted using both edges, the input clock period is halved (e.g. /4 both edges = /2 rising edge). if phase counting mode is used on channels 1, 2, 4, and 5, this setting is ignored and the phase counting mode setting has priority. bit 4 ckeg1 bit 3 ckeg0 description 0 0 count at rising edge (initial value) 1 count at falling edge 1 ? count at both edges note: internal clock edge selection is valid when the input clock is /4 or slower. this setting is ignored if the input clock is /1, or when overflow/underflow of another channel is selected. bits 2 to 0?time prescaler 2 to 0 (tpsc2 to tpsc0): these bits select the tcnt counter clock. the clock source can be selected independently for each channel. table 9.4 shows the clock sources that can be set for each channel. table 9.4 tpu clock sources internal clock external clock channel /1 /4 /16 /64 /256 /1024 /4096 tclka tclkb tclkc tclkd overflow/ underflow on another channel 0 1 2 3 4 5 legend: : setting blank: no setting
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 313 of 1108 rej09b0089-0700 channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 0 0 0 0 internal clock: counts on /1 (initial value) 1 internal clock: counts on /4 1 0 internal clock: counts on /16 1 internal clock: counts on /64 1 0 0 external clock: counts on tclka pin input 1 external clock: counts on tclkb pin input 1 0 external clock: counts on tclkc pin input 1 external clock: counts on tclkd pin input channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 1 0 0 0 internal clock: counts on /1 (initial value) 1 internal clock: counts on /4 1 0 internal clock: counts on /16 1 internal clock: counts on /64 1 0 0 external clock: counts on tclka pin input 1 external clock: counts on tclkb pin input 1 0 internal clock: counts on /256 1 counts on tcnt2 overflow/underflow note: this setting is ignored when channel 1 is in phase counting mode. channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 2 0 0 0 internal clock: counts on /1 (initial value) 1 internal clock: counts on /4 1 0 internal clock: counts on /16 1 internal clock: counts on /64 1 0 0 external clock: counts on tclka pin input 1 external clock: counts on tclkb pin input 1 0 external clock: counts on tclkc pin input 1 internal clock: counts on /1024 note: this setting is ignored when channel 2 is in phase counting mode.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 314 of 1108 rej09b0089-0700 channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 3 0 0 0 internal clock: counts on /1 (initial value) 1 internal clock: counts on /4 1 0 internal clock: counts on /16 1 internal clock: counts on /64 1 0 0 external clock: counts on tclka pin input 1 internal clock: counts on /1024 1 0 internal clock: counts on /256 1 internal clock: counts on /4096 channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 4 0 0 0 internal clock: counts on /1 (initial value) 1 internal clock: counts on /4 1 0 internal clock: counts on /16 1 internal clock: counts on /64 1 0 0 external clock: counts on tclka pin input 1 external clock: counts on tclkc pin input 1 0 internal clock: counts on /1024 1 counts on tcnt5 overflow/underflow note: this setting is ignored when channel 4 is in phase counting mode. channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 5 0 0 0 internal clock: counts on /1 (initial value) 1 internal clock: counts on /4 1 0 internal clock: counts on /16 1 internal clock: counts on /64 1 0 0 external clock: counts on tclka pin input 1 external clock: counts on tclkc pin input 1 0 internal clock: counts on /256 1 external clock: counts on tclkd pin input note: this setting is ignored when channel 5 is in phase counting mode.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 315 of 1108 rej09b0089-0700 9.2.2 timer mode registers (tmdr) channel 0: tmdr0 channel 3: tmdr3 bit : 7 6 5 4 3 2 1 0 ? ? bfb bfa md3 md2 md1 md0 initial value : 1 1 0 0 0 0 0 0 r/w : ? ? r/w r/w r/w r/w r/w r/w channel 1: tmdr1 channel 2: tmdr2 channel 4: tmdr4 channel 5: tmdr5 bit : 7 6 5 4 3 2 1 0 ? ? ? ? md3 md2 md1 md0 initial value : 1 1 0 0 0 0 0 0 r/w : ? ? ? ? r/w r/w r/w r/w the tmdr registers are 8-bit readable/writable re gisters that are used to set the operating mode for each channel. the tpu has six tmdr registers, one for each channel. the tmdr registers are initialized to h'c0 by a reset and in hardware standby mode. tmdr register settings should be made only when tcnt operation is stopped. bits 7 and 6?reserved: these bits cannot be modified and are always read as 1. bit 5?buffer operation b (bfb): specifies whether tgrb is to operate in the normal way, or tgrb and tgrd are to be used together for buff er operation. when tgrd is used as a buffer register, tgrd input capture/output compare is not generated. in channels 1, 2, 4, and 5, which have no tgrd, bit 5 is reserved. it is always read as 0 and cannot be modified. bit 5 bfb description 0 tgrb operates normally (initial value) 1 tgrb and tgrd used together for buffer operation
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 316 of 1108 rej09b0089-0700 bit 4?buffer operation a (bfa): specifies whether tgra is to operate in the normal way, or tgra and tgrc are to be used together for buffer operation. when tgrc is used as a buffer register, tgrc input capture/output compare is not generated. in channels 1, 2, 4, and 5, which have no tgrc, bit 4 is reserved. it is always read as 0 and cannot be modified. bit 4 bfa description 0 tgra operates normally (initial value) 1 tgra and tgrc used together for buffer operation bits 3 to 0?modes 3 to 0 (md3 to md0): these bits are used to set the timer operating mode. bit 3 md3 * 1 bit 2 md2 * 2 bit 1 md1 bit 0 md0 description 0 0 0 0 normal operation (initial value) 1 reserved 1 0 pwm mode 1 1 pwm mode 2 1 0 0 phase counting mode 1 1 phase counting mode 2 1 0 phase counting mode 3 1 phase counting mode 4 1 ? : don?t care notes: 1. md3 is a reserved bit. in a write, it should always be written with 0. 2. phase counting mode cannot be set for channels 0 and 3. for these channels, 0 should always be written to md2.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 317 of 1108 rej09b0089-0700 9.2.3 timer i/o control registers (tior) channel 0: tior0h channel 1: tior1 channel 2: tior2 channel 3: tior3h channel 4: tior4 channel 5: tior5 bit : 7 6 5 4 3 2 1 0 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w channel 0: tior0l channel 3: tior3l bit : 7 6 5 4 3 2 1 0 iod3 iod2 iod1 iod0 ioc3 ioc2 ioc1 ioc0 initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w note: when tgrc or tgrd is designated for buffer operation, this setting is invalid and the register operates as a buffer register. the tior registers are 8-bit registers that control the tgr registers. the tpu has eight tior registers, two each for channels 0 and 3, and one each for channels 1, 2, 4, and 5. the tior registers are initialized to h'00 by a reset and in hardware standby mode. care is required since tior is affected by the tmdr setting. the initial output specified by tior is valid when the counter is stopped (the cst bit in tstr is cleared to 0). note also that, in pwm mode 2, the output at the point at which the counter is cleared to 0 is specified.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 318 of 1108 rej09b0089-0700 bits 7 to 4? i/o control b3 to b0 (iob3 to iob0) i/o control d3 to d0 (iod3 to iod0): bits iob3 to iob0 specify the function of tgrb. bits iod3 to iod0 specify the function of tgrd. channel bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 description 0 0 0 0 0 output disabled (initial value) 1 0 output at compare match 1 0 1 output at compare match 1 tgr0b is output compare register initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 capture input source is tiocb0 pin input capture at both edges 1 tgr0b is input capture register capture input source is channel 1/count clock input capture at tcnt1 count-up/count-down * : don?t care note: * when bits tpsc2 to tpsc0 in tcr1 are set to b'000 and /1 is used as the tcnt1 count clock, this setting is invalid and input capture is not generated.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 319 of 1108 rej09b0089-0700 channel bit 7 iod3 bit 6 iod2 bit 5 iod1 bit 4 iod0 description 0 0 0 0 0 output disabled (initial value) 1 0 output at compare match 1 0 1 output at compare match 1 tgr0d is output compare register * 2 initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 toggle output at compare match 0 input capture at rising edge 0 1 input capture at falling edge 1 0 1 capture input source is tiocd0 pin input capture at both edges 1 tgr0d is input capture register * 2 capture input source is channel 1/count clock input capture at tcnt1 count-up/count-down * 1 : don?t care notes: 1. when bits tpsc2 to tpsc0 in tcr1 are set to b'000 and /1 is used as the tcnt1 count clock, this setting is invalid and input capture is not generated. 2. when the bfb bit in tmdr0 is set to 1 and tgr0d is used as a buffer register, this setting is invalid and input capture/output compare is not generated.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 320 of 1108 rej09b0089-0700 channel bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 description 1 0 0 0 0 output disabled (initial value) 1 0 output at compare match 1 0 1 output at compare match 1 tgr1b is output compare register initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 capture input source is tiocb1 pin input capture at both edges 1 tgr1b is input capture register capture input source is tgr0c compare match/ input capture input capture at generation of tgr0c compare match/input capture : don?t care channel bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 description 2 0 0 0 0 output disabled (initial value) 1 0 output at compare match 1 0 1 output at compare match 1 tgr2b is output compare register initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 toggle output at compare match 0 input capture at rising edge 0 1 input capture at falling edge 1 1 tgr2b is input capture register capture input source is tiocb2 pin input capture at both edges : don?t care
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 321 of 1108 rej09b0089-0700 channel bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 description 3 0 0 0 0 output disabled (initial value) 1 0 output at compare match 1 0 1 output at compare match 1 tgr3b is output compare register initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 capture input source is tiocb3 pin input capture at both edges 1 tgr3b is input capture register capture input source is channel 4/count clock input capture at tcnt4 count-up/count-down * : don?t care note: * when bits tpsc2 to tpsc0 in tcr4 are set to b'000 and /1 is used as the tcnt4 count clock, this setting is invalid and input capture is not generated.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 322 of 1108 rej09b0089-0700 channel bit 7 iod3 bit 6 iod2 bit 5 iod1 bit 4 iod0 description 3 0 0 0 0 output disabled (initial value) 1 0 output at compare match 1 0 1 output at compare match 1 tgr3d is output compare register * 2 initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 capture input source is tiocd3 pin input capture at both edges 1 tgr3d is input capture register * 2 capture input source is channel 4/count clock input capture at tcnt4 count-up/count-down * 1 : don?t care notes: 1. when bits tpsc2 to tpsc0 in tcr4 are set to b'000 and /1 is used as the tcnt4 count clock, this setting is invalid and input capture is not generated. 2. when the bfb bit in tmdr3 is set to 1 and tgr3d is used as a buffer register, this setting is invalid and input capture/output compare is not generated.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 323 of 1108 rej09b0089-0700 channel bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 description 4 0 0 0 0 output disabled (initial value) 1 0 output at compare match 1 0 1 output at compare match 1 tgr4b is output compare register initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 capture input source is tiocb4 pin input capture at both edges 1 tgr4b is input capture register capture input source is tgr3c compare match/ input capture input capture at generation of tgr3c compare match/ input capture : don?t care channel bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 description 5 0 0 0 0 output disabled (initial value) 1 0 output at compare match 1 0 1 output at compare match 1 tgr5b is output compare register initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 toggle output at compare match 1 0 0 input capture at rising edge 1 input capture at falling edge 1 tgr5b is input capture register capture input source is tiocb5 pin input capture at both edges : don?t care
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 324 of 1108 rej09b0089-0700 bits 3 to 0? i/o control a3 to a0 (ioa3 to ioa0) i/o control c3 to c0 (ioc3 to ioc0): ioa3 to ioa0 specify the function of tgra. ioc3 to ioc0 specify the function of tgrc. channel bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 description 0 0 0 0 0 output disabled (initial value) 1 0 output at compare match` 1 0 1 output at compare match 1 tgr0a is output compare register initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 capture input source is tioca0 pin input capture at both edges 1 tgr0a is input capture register capture input source is channel 1/count clock input capture at tcnt1 count-up/count-down : don?t care
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 325 of 1108 rej09b0089-0700 channel bit 3 ioc3 bit 2 ioc2 bit 1 ioc1 bit 0 ioc0 description 0 0 0 0 0 output disabled (initial value) 1 0 output at compare match 1 0 1 output at compare match 1 tgr0c is output compare register * 1 initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 capture input source is tiocc0 pin input capture at both edges 1 tgr0c is input capture register * capture input source is channel 1/count clock input capture at tcnt1 count-up/count-down : don?t care note: * when the bfa bit in tmdr0 is set to 1 and tgr0c is used as a buffer register, this setting is invalid and input capture/output compare is not generated.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 326 of 1108 rej09b0089-0700 channel bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 description 1 0 0 0 0 output disabled (initial value) 1 0 output at compare match 1 0 1 output at compare match 1 tgr1a is output compare register initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 capture input source is tioca1 pin input capture at both edges 1 tgr1a is input capture register capture input source is tgr0a compare match/ input capture input capture at generation of channel 0/tgr0a compare match/input capture : don?t care channel bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 description 2 0 0 0 0 output disabled (initial value) 1 0 output at compare match 1 0 1 output at compare match 1 tgr2a is output compare register initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 toggle output at compare match 1 0 0 input capture at rising edge 1 input capture at falling edge 1 tgr2a is input capture register capture input source is tioca2 pin input capture at both edges : don?t care
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 327 of 1108 rej09b0089-0700 channel bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 description 3 0 0 0 0 output disabled (initial value) 1 0 output at compare match 1 0 1 output at compare match 1 tgr3a is output compare register initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 capture input source is tioca3 pin input capture at both edges 1 tgr3a is input capture register capture input source is channel 4/count clock input capture at tcnt4 count-up/count-down : don?t care
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 328 of 1108 rej09b0089-0700 channel bit 3 ioc3 bit 2 ioc2 bit 1 ioc1 bit 0 ioc0 description 3 0 0 0 0 output disabled (initial value) 1 0 output at compare match 1 0 1 output at compare match 1 tgr3c is output compare register * 1 initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 capture input source is tiocc3 pin input capture at both edges 1 tgr3c is input capture register * capture input source is channel 4/count clock input capture at tcnt4 count-up/count-down : don?t care note: * when the bfa bit in tmdr3 is set to 1 and tgr3c is used as a buffer register, this setting is invalid and input capture/output compare is not generated.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 329 of 1108 rej09b0089-0700 channel bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 description 4 0 0 0 0 output disabled (initial value) 1 0 output at compare match 1 0 1 output at compare match 1 tgr4a is output compare register initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 capture input source is tioca4 pin input capture at both edges 1 tgr4a is input capture register capture input source is tgr3a compare match/ input capture input capture at generation of tgr3a compare match/input capture : don?t care channel bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 description 5 0 0 0 0 output disabled (initial value) 1 0 output at compare match 1 0 1 output at compare match 1 tgr5a is output compare register initial output is 0 output toggle output at compare match 1 0 0 output disabled 1 0 output at compare match 1 0 initial output is 1 output 1 output at compare match 1 toggle output at compare match 1 0 0 input capture at rising edge 1 input capture at falling edge 1 tgr5a is input capture register capture input source is tioca5 pin input capture at both edges : don?t care
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 330 of 1108 rej09b0089-0700 9.2.4 timer interrupt enable registers (tier) channel 0: tier0 channel 3: tier3 bit : 7 6 5 4 3 2 1 0 ttge ? ? tciev tgied tgiec tgieb tgiea initial value : 0 1 0 0 0 0 0 0 r/w : r/w ? ? r/w r/w r/w r/w r/w channel 1: tier1 channel 2: tier2 channel 4: tier4 channel 5: tier5 bit : 7 6 5 4 3 2 1 0 ttge ? tcieu tciev ? ? tgieb tgiea initial value : 0 1 0 0 0 0 0 0 r/w : r/w ? r/w r/w ? ? r/w r/w the tier registers are 8-bit registers that contro l enabling or disabling of interrupt requests for each channel. the tpu has six tier registers, one for each channel. the tier registers are initialized to h'40 by a reset and in hardware standby mode. bit 7?a/d conversion start request enable (ttge): enables or disables generation of a/d conversion start requests by tgra input capture/compare match. bit 7 ttge description 0 a/d conversion start request generation disabled (initial value) 1 a/d conversion start request generation enabled bit 6?reserved: this bit cannot be modified and is always read as 1.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 331 of 1108 rej09b0089-0700 bit 5?underflow interrupt enable (tcieu): enables or disables interrupt requests (tciu) by the tcfu bit when the tcfu bit in tsr is set to 1 in channels 1 and 2. in channels 0 and 3, bit 5 is reserved. it is always read as 0 and cannot be modified. bit 5 tcieu description 0 interrupt requests (tciu) by tcfu disabled (initial value) 1 interrupt requests (tciu) by tcfu enabled bit 4?overflow interrupt enable (tciev): enables or disables interrupt requests (tciv) by the tcfv bit when the tcfv bit in tsr is set to 1. bit 4 tciev description 0 interrupt requests (tciv) by tcfv disabled (initial value) 1 interrupt requests (tciv) by tcfv enabled bit 3?tgr interrupt enable d (tgied): enables or disables interrupt requests (tgid) by the tgfd bit when the tgfd bit in tsr is set to 1 in channels 0 and 3. in channels 1, 2, 4, and 5, bit 3 is reserved. it is always read as 0 and cannot be modified. bit 3 tgied description 0 interrupt requests (tgid) by tgfd disabled (initial value) 1 interrupt requests (tgid) by tgfd enabled bit 2?tgr interrupt enable c (tgiec): enables or disables interrupt requests (tgic) by the tgfc bit when the tgfc bit in tsr is set to 1 in channels 0 and 3. in channels 1, 2, 4, and 5, bit 2 is reserved. it is always read as 0 and cannot be modified. bit 2 tgiec description 0 interrupt requests (tgic) by tgfc disabled (initial value) 1 interrupt requests (tgic) by tgfc enabled
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 332 of 1108 rej09b0089-0700 bit 1?tgr interrupt enable b (tgieb): enables or disables interrupt requests (tgib) by the tgfb bit when the tgfb bit in tsr is set to 1. bit 1 tgieb description 0 interrupt requests (tgib) by tgfb disabled (initial value) 1 interrupt requests (tgib) by tgfb enabled bit 0?tgr interrupt enable a (tgiea): enables or disables interrupt requests (tgia) by the tgfa bit when the tgfa bit in tsr is set to 1. bit 0 tgiea description 0 interrupt requests (tgia) by tgfa disabled (initial value) 1 interrupt requests (tgia) by tgfa enabled
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 333 of 1108 rej09b0089-0700 9.2.5 timer status registers (tsr) channel 0: tsr0 channel 3: tsr3 bit : 7 6 5 4 3 2 1 0 ? ? ? tcfv tgfd tgfc tgfb tgfa initial value : 1 1 0 0 0 0 0 0 r/w : ? ? ? r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * note: * only 0 can be written, to clear the flag. channel 1: tsr1 channel 2: tsr2 channel 4: tsr4 channel 5: tsr5 bit : 7 6 5 4 3 2 1 0 tcfd ? tcfu tcfv ? ? tgfb tgfa initial value : 1 1 0 0 0 0 0 0 r/w : r ? r/(w) * r/(w) * ? ? r/(w) * r/(w) * note: * only 0 can be written, to clear the flag. the tsr registers are 8-bit registers that indicate the status of each channel. the tpu has six tsr registers, one for each channel. the tsr registers are initialized to h'c0 by a reset and in hardware standby mode. bit 7?count direction flag (tcfd): status flag that shows the direction in which tcnt counts in channels 1, 2, 4, and 5. in channels 0 and 3, bit 7 is reserved. it is always read as 1 and cannot be modified. bit 7 tcfd description 0 tcnt counts down 1 tcnt counts up (initial value)
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 334 of 1108 rej09b0089-0700 bit 6?reserved: this bit cannot be modified and is always read as 1. bit 5?underflow flag (tcfu): status flag that indicates that tcnt underflow has occurred when channels 1, 2, 4, and 5 are set to phase counting mode. in channels 0 and 3, bit 5 is reserved. it is always read as 0 and cannot be modified. bit 5 tcfu description 0 [clearing condition] (initial value) when 0 is written to tcfu after reading tcfu = 1 1 [setting condition] when the tcnt value underflows (changes from h'0000 to h'ffff) bit 4?overflow flag (tcfv): status flag that indicates that tcnt overflow has occurred. bit 4 tcfv description 0 [clearing condition] (initial value) when 0 is written to tcfv after reading tcfv = 1 1 [setting condition] when the tcnt value overflows (changes from h'ffff to h'0000 ) bit 3?input capture/output compare flag d (tgfd): status flag that indicates the occurrence of tgrd input capture or compare match in channels 0 and 3. in channels 1, 2, 4, and 5, bit 3 is reserved. it is always read as 0 and cannot be modified. bit 3 tgfd description 0 [clearing conditions] (initial value) ? when dtc is activated by tgid interrupt while disel bit of mrb in dtc is 0 ? when 0 is written to tgfd after reading tgfd = 1 1 [setting conditions] ? when tcnt = tgrd while tgrd is functioning as output compare register ? when tcnt value is transferred to tgrd by input capture signal while tgrd is functioning as input capture register
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 335 of 1108 rej09b0089-0700 bit 2?input capture/output compare flag c (tgfc): status flag that indicates the occurrence of tgrc input capture or compare match in channels 0 and 3. in channels 1, 2, 4, and 5, bit 2 is reserved. it is always read as 0 and cannot be modified. bit 2 tgfc description 0 [clearing conditions] (initial value) ? when dtc is activated by tgic interrupt while disel bit of mrb in dtc is 0 ? when 0 is written to tgfc after reading tgfc = 1 1 [setting conditions] ? when tcnt = tgrc while tgrc is functioning as output compare register ? when tcnt value is transferred to tgrc by input capture signal while tgrc is functioning as input capture register bit 1?input capture/output compare flag b (tgfb): status flag that indicates the occurrence of tgrb input capture or compare match. bit 1 tgfb description 0 [clearing conditions] (initial value) ? when dtc is activated by tgib interrupt while disel bit of mrb in dtc is 0 ? when 0 is written to tgfb after reading tgfb = 1 1 [setting conditions] ? when tcnt = tgrb while tgrb is functioning as output compare register ? when tcnt value is transferred to tgrb by input capture signal while tgrb is functioning as input capture register
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 336 of 1108 rej09b0089-0700 bit 0?input capture/output compare flag a (tgfa): status flag that indicates the occurrence of tgra input capture or compare match. bit 0 tgfa description 0 [clearing conditions] (initial value) ? when dtc is activated by tgia interrupt while disel bit of mrb in dtc is 0 ? when 0 is written to tgfa after reading tgfa = 1 1 [setting conditions] ? when tcnt = tgra while tgra is functioning as output compare register ? when tcnt value is transferred to tgra by input capture signal while tgra is functioning as input capture register 9.2.6 timer counters (tcnt) channel 0: tcnt0 (up-counter) channel 1: tcnt1 (up/down-counter * ) channel 2: tcnt2 (up/down-counter * ) channel 3: tcnt3 (up-counter) channel 4: tcnt4 (up/down-counter * ) channel 5: tcnt5 (up/down-counter * ) bit : 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value : 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w note: * these counters can be used as up/down-counters only in phase counting mode or when counting overflow/underflow on another channel. in other cases they function as up- counters. the tcnt registers are 16-bit counters. the tpu has six tcnt counters, one for each channel. the tcnt counters are initialized to h'0000 by a reset and in hardware standby mode. the tcnt counters cannot be accessed in 8-bit units; they must always be accessed as a 16-bit unit.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 337 of 1108 rej09b0089-0700 9.2.7 timer general registers (tgr) bit : 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value : 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w : r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w the tgr registers are 16-bit registers with a dual function as output compare and input capture registers. the tpu has 16 tgr registers, four each for channels 0 and 3 and two each for channels 1, 2, 4, and 5. tgrc and tgrd for channels 0 and 3 can also be designated for operation as buffer registers * . the tgr registers are initialized to h'ffff by a reset and in hardware standby mode. the tgr registers cannot be accessed in 8-bit units; they must always be accessed as a 16-bit unit. note: * tgr buffer register combinations are tgra?tgrc and tgrb?tgrd. 9.2.8 timer start register (tstr) bit : 7 6 5 4 3 2 1 0 ? ? cst5 cst4 cst3 cst2 cst1 cst0 initial value : 0 0 0 0 0 0 0 0 r/w : ? ? r/w r/w r/w r/w r/w r/w tstr is an 8-bit readable/writable register that selects operation/stoppage for channels 0 to 5. tstr is initialized to h'00 by a reset, and in hardware standby mode. when setting the operating mode in tmdr or setting the count clock in tcr, first stop the tcnt counter. bits 7 and 6?reserved: must always be written with 0.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 338 of 1108 rej09b0089-0700 bits 5 to 0?counter start 5 to 0 (cst5 to cst0): these bits select operation or stoppage for tcnt. bit n cstn description 0 tcntn count operation is stopped (initial value) 1 tcntn performs count operation n = 5 to 0 note: if 0 is written to the cst bit during operation with the tioc pin designated for output, the counter stops but the tioc pin output compare output level is retained. if tior is written to when the cst bit is cleared to 0, the pin output level will be changed to the set initial output value. 9.2.9 timer synchro register (tsyr) bit : 7 6 5 4 3 2 1 0 ? ? sync5 sync4 sync3 sync2 sync1 sync0 initial value : 0 0 0 0 0 0 0 0 r/w : ? ? r/w r/w r/w r/w r/w r/w tsyr is an 8-bit readable/writable register that selects independent operation or synchronous operation for the channel 0 to 4 tcnt counters. a channel performs synchronous operation when the corresponding bit in tsyr is set to 1. tsyr is initialized to h'00 by a reset and in hardware standby mode. bits 7 and 6?reserved: must always be written with 0. bits 5 to 0?timer synchro 5 to 0 (sync5 to sync0): these bits select whether operation is independent of or synchronized with other channels. when synchronous operation is selected, synchronous presetting of multiple channels * 1 , and synchronous clearing through counter clearing on another channel * 2 are possible. notes: 1. to set synchronous operation, the sync bits for at least two channels must be set to 1. 2. to set synchronous clearing, in addition to the sync bit, the tcnt clearing source must also be set by means of bits cclr2 to cclr0 in tcr.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 339 of 1108 rej09b0089-0700 bit n syncn description 0 tcntn operates independently (tcnt presetting/clearing is unrelated to other channels) (initial value) 1 tcntn performs synchronous operation tcnt synchronous presetting/synchronous clearing is possible n = 5 to 0 9.2.10 module stop control register (mstpcr) mstpcrh mstpcrl bit : 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value : 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w : r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w mstpcr is a 16-bit readable/writable register that performs module stop mode control. when the mstp13 bit in mstpcr is set to 1, tpu operation stops at the end of the bus cycle and a transition is made to module stop mode. registers cannot be read or written to in module stop mode. for details, see section 19.5, module stop mode. mstpcr is initialized to h'3fff by a reset and in ha rdware standby mode. it is not initialized in software standby mode. bit 13?module stop (mstp13): specifies the tpu module stop mode. bit 13 mstp13 description 0 tpu module stop mode cleared 1 tpu module stop mode set (initial value)
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 340 of 1108 rej09b0089-0700 9.3 interface to bus master 9.3.1 16-bit registers tcnt and tgr are 16-bit registers. as the data bus to the bus master is 16 bits wide, these registers can be read and written to in 16-bit units. these registers cannot be read or written to in 8-bit units; 16-bit access must always be used. an example of 16-bit register access operation is shown in figure 9.2. bus interface h internal data bus l bus master module data bu s tcnth tcntl figure 9.2 16-bit register access operation [bus master ? tcnt (16 bits)] 9.3.2 8-bit registers registers other than tcnt and tgr are 8-bit. as the data bus to the cpu is 16 bits wide, these registers can be read and written to in 16-bit units. they can also be read and written to in 8-bit units.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 341 of 1108 rej09b0089-0700 examples of 8-bit register access operation are shown in figures 9.3 to 9.5. bus interface h internal data bus l module data bus tcr bus master figure 9.3 8-bit register a ccess operation [bus master ? tcr (upper 8 bits)] bus interface h internal data bus l module data bus tmdr bus master figure 9.4 8-bit register a ccess operation [bus master ? tmdr (lower 8 bits)] bus interface h internal data bus l module data bus tcr tmdr bus master figure 9.5 8-bit register a ccess operation [bus master ? tcr and tmdr (16 bits)]
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 342 of 1108 rej09b0089-0700 9.4 operation 9.4.1 overview operation in each mode is outlined below. normal operation: each channel has a tcnt and tgr register. tcnt performs up-counting, and is also capable of free-running operation, synchronous counting, and external event counting. each tgr can be used as an input capture register or output compare register. synchronous operation: when synchronous operation is designated for a channel, tcnt for that channel performs synchronous presetting. that is, when tcnt for a channel designated for synchronous operation is rewritten, the tcnt counters for the other channels are also rewritten at the same time. synchronous clearing of the tcnt counters is also possible by setting the timer synchronization bits in tsyr for channels designated for synchronous operation. buffer operation ? when tgr is an output compare register when a compare match occurs, the value in the buffer register for the relevant channel is transferred to tgr. ? when tgr is an input capture register when input capture occurs, the value in tcnt is transferred to tgr and the value previously held in tgr is transferred to the buffer register. cascaded operation: the channel 1 counter (tcnt1) and channel 2 counter (tcnt2), or the channel 4 counter (tcnt4) and channel 5 counter (t cnt5), can be connected together to operate as a 32-bit counter. pwm mode: in this mode, a pwm waveform is output. the output level can be set by means of tior. a pwm waveform with a duty of between 0% and 100% can be output, according to the setting of each tgr register. phase counting mode: in this mode, tcnt is incremented or decremented by detecting the phases of two clocks input from the external clock input pins in channels 1, 2, 4, and 5. when phase counting mode is set, the corresponding tclk pin functions as the clock pin, and tcnt performs up/down-counting. this can be used for two-phase encoder pulse input.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 343 of 1108 rej09b0089-0700 9.4.2 basic functions counter operation: when one of bits cst0 to cst5 is set to 1 in tstr, the tcnt counter for the corresponding channel starts counting. tcnt can operate as a free-running counter, periodic counter, and so on. ? example of count operation setting procedure figure 9.6 shows an example of the count operation setting procedure. select counter clock operation selection select counter clearing source periodic counter set period start count [1] [2] [4] [3] [5] free-running counter start count [5] [1] [2] [3] [4] [5] select output compare register select the counter clock with bits tpsc2 to tpsc0 in tcr. at the same time, select the input clock edge with bits ckeg1 and ckeg0 in tcr. for periodic counter operation, select the tgr to be used as the tcnt clearing source with bits cclr2 to cclr0 in tcr. designate the tgr selected in [2] as an output compare register by means of tior. set the periodic counter cycle in the tgr selected in [2]. set the cst bit in tstr to 1 to start the counter operation. figure 9.6 example of count er operation setting procedure
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 344 of 1108 rej09b0089-0700 ? free-running count operation and periodic count operation immediately after a reset, the tpu?s tcnt counters are all designated as free-running counters. when the relevant bit in tstr is set to 1 the corresponding tcnt counter starts up- count operation as a free-running counter. when tcnt overflows (from h'ffff to h'0000), the tcfv bit in tsr is set to 1. if the value of the corresponding tciev bit in tier is 1 at this point, the tpu requests an interrupt. afte r overflow, tcnt starts counting up again from h'0000. figure 9.7 illustrates free-running counter operation. tcnt value h'ffff h'0000 cst bit tcfv time figure 9.7 free-running counter operation when compare match is selected as the tcnt clearing source, the tcnt counter for the relevant channel performs periodic count operation. the tgr register for setting the period is designated as an output compare register, and counter clearing by compare match is selected by means of bits cclr2 to cclr0 in tcr. after the settings have been made, tcnt starts up-count operation as a periodic counter when the corresponding bit in tstr is set to 1. when the count value matches the value in tgr, the tgf bit in tsr is set to 1 and tcnt is cleared to h'0000. if the value of the corresponding tgie bit in ti er is 1 at this point , the tpu requests an interrupt. after a compare match, tcnt starts counting up again from h'0000. figure 9.8 illustrates periodic counter operation.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 345 of 1108 rej09b0089-0700 tcnt value tgr h'0000 cst bit tgf time counter cleared by tgr compare match flag cleared by software or dtc activation figure 9.8 period ic counter operation waveform output by compare match: the tpu can perform 0, 1, or toggle output from the corresponding output pin using compare match. ? example of setting procedure for waveform output by compare match figure 9.9 shows an example of the setting procedure for waveform output by compare match select waveform output mode output selection set output timing start count [1] [2] [3] [1] select initial value 0 output or 1 output, and compare match output value 0 output, 1 output, or toggle output, by means of tior. the set initial value is output at the tioc pin until the first compare match occurs. [2] set the timing for compare match generation in tgr. [3] set the cst bit in tstr to 1 to start the count operation. figure 9.9 example of setting procedu re for waveform output by compare match
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 346 of 1108 rej09b0089-0700 ? examples of waveform output operation figure 9.10 shows an example of 0 output/1 output. in this example tcnt has been designated as a free-running counter, and settings have been made so that 1 is output by compare match a, and 0 is output by compare match b. when the set level and the pin level coincide, the pin level does not change. tcnt value h'ffff h'0000 tioca tiocb tim e tgra tgrb no change no change no change no change 1 output 0 output figure 9.10 example of 0 output/1 output operation figure 9.11 shows an example of toggle output. in this example tcnt has been designated as a periodic counter (with counter clearing performed by compare match b), and settings have been made so that output is toggled by both compare match a and compare match b. tcnt value h'ffff h'0000 tiocb tioca time tgrb tgra toggle output toggle output counter cleared by tgrb compare match figure 9.11 example of toggle output operation
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 347 of 1108 rej09b0089-0700 input capture function: the tcnt value can be transferred to tgr on detection of the tioc pin input edge. rising edge, falling edge, or both edges can be select ed as the detected edge. for channels 0, 1, 3, and 4, it is also possible to specify another channel?s counter input clock or compare match signal as the input capture source. note: when another channel?s counter input clock is used as the input capture input for channels 0 and 3, /1 should not be selected as the counter input clock used for input capture input. input capture will not be generated if /1 is selected. ? example of input capture operation setting procedure figure 9.12 shows an example of the input capture operation setting procedure. select input capture input input selection start count [1] [2] [1] designate tgr as an input capture register by means of tior, and select the input capture source and input signal edge (rising edge, falling edge, or both edges). [2] set the cst bit in tstr to 1 to start the count operation. figure 9.12 example of input ca pture operation setting procedure
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 348 of 1108 rej09b0089-0700 ? example of input capture operation figure 9.13 shows an example of input capture operation. in this example both rising and falling edges have been selected as the tioca pin input capture input edge, falling edge has been selected as the tiocb pin input capture input edge, and counter clearing by tgrb input capture has been designated for tcnt. tcnt value h'0180 h'0000 tioca tgra time h'0010 h'0005 counter cleared by tiocb input (falling edge) h'0160 h'0005 h'0160 h'0010 tgrb h'0180 tiocb figure 9.13 example of input capture operation
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 349 of 1108 rej09b0089-0700 9.4.3 synchronous operation in synchronous operation, the values in a number of tcnt counters can be rewritten simultaneously (synchronous presetting). also, a number of tcnt counters can be cleared simultaneously by making the appropriate setting in tcr (synchronous clearing). synchronous operation enables tgr to be incremented with respect to a single time base. channels 0 to 5 can all be designated for synchronous operation. example of synchronous operation setting procedure: figure 9.14 shows an example of the synchronous operation setting procedure. synchronous operation selection set tcnt synchronous presetting [1] [2] synchronous clearing select counter clearing source [3] start count [5] set synchronous counter clearing [4] start count [5] clearing source generation channel? no yes [1] set to 1 the sync bits in tsyr corresponding to the channels to be designated for synchronous operation. [2] when the tcnt counter of any of the channels designated for synchronous operation is written to, the same value is simultaneously written to the other tcnt counters. [3] use bits cclr2 to cclr0 in tcr to specify tcnt clearing by input capture/output compare, etc. [4] use bits cclr2 to cclr0 in tcr to designate synchronous clearing for the counter clearing source. [5] set to 1 the cst bits in tstr for the relevant channels, to start the count operation. set synchronous operation figure 9.14 example of synchronous operation setting procedure
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 350 of 1108 rej09b0089-0700 example of synchronous operation: figure 9.15 shows an example of synchronous operation. in this example, synchronous operation and pwm mode 1 have been designated for channels 0 to 2, tgr0b compare match has been set as the channel 0 counter clearing source, and synchronous clearing has been set for the channel 1 and 2 counter clearing sources. three-phase pwm waveforms are output from pins tioc0a, tioc1a, and tioc2a. at this time, synchronous presetting, and synchronous clearing by tgr0b compare match, is performed for channel 0 to 2 tcnt counters, and the data set in tgr0b is used as the pwm cycle. for details of pwm modes, see section 9.4.6, pwm modes. tcnt0 to tcnt2 values h'0000 tioc0a tioc1a time tgr0b synchronous clearing by tgr0b compare match tgr2a tgr1a tgr2b tgr0a tgr1b tioc2a figure 9.15 example of synchronous operation
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 351 of 1108 rej09b0089-0700 9.4.4 buffer operation buffer operation, provided for channels 0 and 3, enables tgrc and tgrd to be used as buffer registers. buffer operation differs depending on whether tgr has been designated as an input capture register or as a compare match register. table 9.5 shows the register combinations used in buffer operation. table 9.5 register combinat ions in buffer operation channel timer general re gister buffer register 0 tgr0a tgr0c tgr0b tgr0d 3 tgr3a tgr3c tgr3b tgr3d ? when tgr is an output compare register when a compare match occurs, the value in the buffer register for the corresponding channel is transferred to the timer general register. this operation is illustrated in figure 9.16. buffer register timer general register tcnt comparator compare match signal figure 9.16 compare match buffer operation
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 352 of 1108 rej09b0089-0700 ? when tgr is an input capture register when input capture occurs, the value in tcnt is transferred to tgr and the value previously held in the timer general register is transferred to the buffer register. this operation is illustrated in figure 9.17. buffer register timer general register tcnt input capture signal figure 9.17 input capture buffer operation example of buffer operation setting procedure: figure 9.18 shows an example of the buffer operation setting procedure. select tgr function buffer operation set buffer operation start count [1] [2] [3] [1] designate tgr as an input capture register or output compare register by means of tior. [2] designate tgr for buffer operation with bits bfa and bfb in tmdr. [3] set the cst bit in tstr to 1 to start the count operation. figure 9.18 example of buff er operation setting procedure
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 353 of 1108 rej09b0089-0700 examples of buffer operation ? when tgr is an output compare register figure 9.19 shows an operation example in which pwm mode 1 has been designated for channel 0, and buffer operation has been designated for tgra and tgrc. the settings used in this example are tcnt clearing by compare match b, 1 output at compare match a, and 0 output at compare match b. as buffer operation has been set, when compar e match a occurs the output changes and the value in buffer register tgrc is simultaneously transferred to timer general register tgra. this operation is repeated each time compare match a occurs. for details of pwm modes, see section 9.4.6, pwm modes. tcnt value tgr0b h'0000 tgr0c time tgr0a h'0200 h'0520 tioca h'0200 h'0450 h'0520 h'0450 tgr0a h'0450 h'0200 transfer figure 9.19 example of buffer operation (1)
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 354 of 1108 rej09b0089-0700 ? when tgr is an input capture register figure 9.20 shows an operation example in which tgra has been designated as an input capture register, and buffer operation has been designated for tgra and tgrc. counter clearing by tgra input capture has been set for tcnt, and both rising and falling edges have been selected as the tioca pin input capture input edge. as buffer operation has been set, when the tcnt value is stored in tgra upon occurrence of input capture a, the value previously stored in tgra is simultaneously transferred to tgrc. tcnt value h'09fb h'0000 tgrc time h'0532 tioca tgra h'0f07 h'0532 h'0f07 h'0532 h'0f07 h'09fb figure 9.20 example of buffer operation (2)
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 355 of 1108 rej09b0089-0700 9.4.5 cascaded operation in cascaded operation, two 16-bit counters for diff erent channels are used together as a 32-bit counter. this function works by counting the channel 1 (channel 4) counter clock upon overflow/underflow of tcnt2 (tcnt5) as set in bits tpsc2 to tpsc0 in tcr. underflow occurs only when the lower 16-bit tcnt is in phase-counting mode. table 9.6 shows the register combinations used in cascaded operation. note: when phase counting mode is set for channel 1 or 4, the counter clock setting is invalid and the counter operates independently in phase counting mode. table 9.6 cascaded combinations combination upper 16 bits lower 16 bits channels 1 and 2 tcnt1 tcnt2 channels 4 and 5 tcnt4 tcnt5 example of cascaded opera tion setting procedure: figure 9.21 shows an example of the setting procedure for cascaded operation. set cascading cascaded operation start count [1] [2] [1] set bits tpsc2 to tpsc0 in the channel 1 (channel 4) tcr to b'111 to select tcnt2 (tcnt5) overflow/underflow counting. [2] set the cst bit in tstr for the upper and lower channel to 1 to start the count operation. figure 9.21 cascaded op eration setting procedure
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 356 of 1108 rej09b0089-0700 examples of cascaded operation: figure 9.22 illustrates the operation when counting upon tcnt2 overflow/underflow has been set for tcnt1, tgr1a and tgr2a have been designated as input capture registers, and tioc pin rising edge has been selected. when a rising edge is input to the tioca1 and tioca2 pins simultaneously, the upper 16 bits of the 32-bit data are transferred to tgr1a, and the lower 16 bits to tgr2a. tcnt2 clock tcnt2 h'ffff h'0000 h'0001 tioca1, tioca2 tgr1a h'03a2 tgr2a h'0000 tcnt1 clock tcnt1 h'03a1 h'03a2 figure 9.22 example of cascaded operation (1) figure 9.23 illustrates the operation when counting upon tcnt2 overflow/underflow has been set for tcnt1, and phase counting mode has been designated for channel 2. tcnt1 is incremented by tcnt2 overflow and decremented by tcnt2 underflow.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 357 of 1108 rej09b0089-0700 tclkc tcnt2 fffd tcnt1 0001 tclkd fffe ffff 0000 0001 0002 0001 0000 ffff 0000 0000 figure 9.23 example of cascaded operation (2) 9.4.6 pwm modes in pwm mode, pwm waveforms are output from the output pins. 0, 1, or toggle output can be selected as the output level in response to compare match of each tgr. designating tgr compare match as the counter clearing source enables the period to be set in that register. all channels can be designated for pwm mode independently. synchronous operation is also possible. there are two pwm modes, as described below. ? pwm mode 1 pwm output is generated from the tioca and tiocc pins by pairing tgra with tgrb and tgrc with tgrd. the output specified by bits ioa3 to ioa0 and ioc3 to ioc0 in tior is output from the tioca and tiocc pins at compare matches a and c, and the output specified by bits iob3 to iob0 and iod3 to iod0 in tior is output at compare matches b and d. the initial output value is the value set in tgra or tgrc. if the set values of paired tgrs are identical, the output value does not change when a compare match occurs. in pwm mode 1, a maximum 8-phase pwm output is possible. ? pwm mode 2 pwm output is generated using one tgr as the period register and the others as duty registers. the output specified in tior is performed by means of compare matches. upon counter clearing by a synchronization register compare match, the output value of each pin is the initial value set in tior. if the set values of the period and duty registers are identical, the output value does not change when a compare match occurs. in pwm mode 2, a maximum 15-phase pwm output is possible by combined use with synchronous operation.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 358 of 1108 rej09b0089-0700 the correspondence between pwm output pins and registers is shown in table 9.7. table 9.7 pwm output registers and output pins output pins channel registers pwm mode 1 pwm mode 2 0 tgr0a tioca0 tioca0 tgr0b tiocb0 tgr0c tiocc0 tiocc0 tgr0d tiocd0 1 tgr1a tioca1 tioca1 tgr1b tiocb1 2 tgr2a tioca2 tioca2 tgr2b tiocb2 3 tgr3a tioca3 tioca3 tgr3b tiocb3 tgr3c tiocc3 tiocc3 tgr3d tiocd3 4 tgr4a tioca4 tioca4 tgr4b tiocb4 5 tgr5a tioca5 tioca5 tgr5b tiocb5 note: in pwm mode 2, pwm output is not possible for the tgr register in which the period is set.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 359 of 1108 rej09b0089-0700 example of pwm mode setting procedure: figure 9.24 shows an example of the pwm mode setting procedure. select counter clock pwm mode select counter clearing source select waveform output level [1] [2] [3] set tgr [4] set pwm mode [5] start count [6] [1] select the counter clock with bits tpsc2 to tpsc0 in tcr. at the same time, select the input clock edge with bits ckeg1 and ckeg0 in tcr. [2] use bits cclr2 to cclr0 in tcr to select the tgr to be used as the tcnt clearing source. [3] use tior to designate the tgr as an output compare register, and select the initial value and output value. [4] set the period in the tgr selected in [2], and set the duty in the other tgr. [5] select the pwm mode with bits md3 to md0 in tmdr. [6] set the cst bit in tstr to 1 to start the count operation. figure 9.24 example of pwm mode setting procedure
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 360 of 1108 rej09b0089-0700 examples of pwm mode operation: figure 9.25 shows an example of pwm mode 1 operation. in this example, tgra compare match is set as the tcnt clearing source, 0 is set for the tgra initial output value and output value, and 1 is set as the tgrb output value. in this case, the value set in tgra is used as the period, and the value set in tgrb as the duty. tcnt value tgra h'0000 tioca time tgrb counter cleared by tgra compare match figure 9.25 example of pwm mode operation (1)
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 361 of 1108 rej09b0089-0700 figure 9.26 shows an example of pwm mode 2 operation. in this example, synchronous operation is designated for channels 0 and 1, tgr1b compare match is set as the tcnt clearing source, and 0 is set for the initial output value and 1 for the output value of the other tgr registers (tgr0a to tgr0d, tgr1a), to output a 5-phase pwm waveform. in this case, the value set in tgr1b is used as the period, and the values set in the other tgr registers as the duty. tcnt value tgr1b h'0000 tioca0 counter cleared by tgr1b compare match tgr1a tgr0d tgr0c tgr0b tgr0a tiocb0 tiocc0 tiocd0 tioca1 time figure 9.26 example of pwm mode operation (2)
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 362 of 1108 rej09b0089-0700 figure 9.27 shows examples of pwm waveform output with 0% duty and 100% duty in pwm mode. tcnt value tgra h'0000 tioca tim e tgrb 0% duty tgrb rewritten tgrb rewritten tgrb rewritten tcnt value tgra h'0000 tioca tim e tgrb 100% duty tgrb rewritten tgrb rewritten tgrb rewritten output does not change when period register and duty register compare matches occur simultaneously tcnt value tgra h'0000 tioca tim e tgrb 100% duty tgrb rewritten tgrb rewritten tgrb rewritten output does not change when period register and duty register compare matches occur simultaneously 0% duty figure 9.27 examples of pwm mode operation (3)
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 363 of 1108 rej09b0089-0700 9.4.7 phase counting mode in phase counting mode, the phase difference betwee n two external clock inputs is detected and tcnt is incremented/decremented accordingly. this mode can be set for channels 1, 2, 4, and 5. when phase counting mode is set, an external clock is selected as the counter input clock and tcnt operates as an up/down-counter regardless of the setting of bits tpsc2 to tpsc0 and bits ckeg1 and ckeg0 in tcr. however, the functions of bits cclr1 and cclr0 in tcr, and of tior, tier, and tgr are valid, and input capture/compare match and interrupt functions can be used. when overflow occurs while tcnt is counting up, the tcfv flag in tsr is set; when underflow occurs while tcnt is counting down, the tcfu flag is set. the tcfd bit in tsr is the count direction flag. reading the tcfd flag provides an indication of whether tcnt is counting up or down. table 9.8 shows the correspondence betwee n external clock pins and channels. table 9.8 phase counting mode clock input pins external clock pins channels a-phase b-phase when channel 1 or 5 is set to phase counting mode tclka tclkb when channel 2 or 4 is set to phase counting mode tclkc tclkd example of phase counting mode setting procedure: figure 9.28 shows an example of the phase counting mode setting procedure. select phase counting mode phase counting mode start count [1] [2] [1] select phase counting mode with bits md3 to md0 in tmdr. [2] set the cst bit in tstr to 1 to start the count operation. figure 9.28 example of phase counting mode setting procedure
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 364 of 1108 rej09b0089-0700 examples of phase counting mode operation: in phase counting mode, tcnt counts up or down according to the phase difference between two external clocks. there are four modes, according to the count conditions. ? phase counting mode 1 figure 9.29 shows an example of phase counting mode 1 operation, and table 9.9 summarizes the tcnt up/down-count conditions. tcnt value time down-count up-count tclka (channels 1 and 5) tclkc (channels 2 and 4) tclkb (channels 1 and 5) tclkd (channels 2 and 4) figure 9.29 example of phase counting mode 1 operation table 9.9 up/down-count conditions in phase counting mode 1 tclka (channels 1 and 5) tclkc (channels 2 and 4) tclkb (channels 1 and 5) tclkd (channels 2 and 4) operation high level up-count low level low level high level high level down-count low level high level low level legend: : rising edge : falling edge
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 365 of 1108 rej09b0089-0700 ? phase counting mode 2 figure 9.30 shows an example of phase counting mode 2 operation, and table 9.10 summarizes the tcnt up/down-count conditions. tcnt value time down-count up-count tclka (channels 1 and 5) tclkc (channels 2 and 4) tclkb (channels 1 and 5) tclkd (channels 2 and 4) figure 9.30 example of phase counting mode 2 operation table 9.10 up/down-count conditions in phase counting mode 2 tclka (channels 1 and 5) tclkc (channels 2 and 4) tclkb (channels 1 and 5) tclkd (channels 2 and 4) operation high level don?t care low level low level high level up-count high level don?t care low level high level low level down-count legend: : rising edge : falling edge
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 366 of 1108 rej09b0089-0700 ? phase counting mode 3 figure 9.31 shows an example of phase counting mode 3 operation, and table 9.11 summarizes the tcnt up/down-count conditions. tcnt value time up-count tclka (channels 1 and 5) tclkc (channels 2 and 4) tclkb (channels 1 and 5) tclkd (channels 2 and 4) down-count figure 9.31 example of phase counting mode 3 operation table 9.11 up/down-count conditions in phase counting mode 3 tclka (channels 1 and 5) tclkc (channels 2 and 4) tclkb (channels 1 and 5) tclkd (channels 2 and 4) operation high level don?t care low level low level high level up-count high level down-count low level don?t care high level low level legend: : rising edge : falling edge
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 367 of 1108 rej09b0089-0700 ? phase counting mode 4 figure 9.32 shows an example of phase counting mode 4 operation, and table 9.12 summarizes the tcnt up/down-count conditions. time tclka (channels 1 and 5) tclkc (channels 2 and 4) tclkb (channels 1 and 5) tclkd (channels 2 and 4) up-count down-count tcnt value figure 9.32 example of phase counting mode 4 operation table 9.12 up/down-count conditions in phase counting mode 4 tclka (channels 1 and 5) tclkc (channels 2 and 4) tclkb (channels 1 and 5) tclkd (channels 2 and 4) operation high level up-count low level low level don?t care high level high level down-count low level high level don?t care low level legend: : rising edge : falling edge
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 368 of 1108 rej09b0089-0700 phase counting mode application example: figure 9.33 shows an example in which phase counting mode is designated for channel 1, and channel 1 is coupled with channel 0 to input servo motor 2-phase encoder pulses in order to detect the position or speed. channel 1 is set to phase counting mode 1, and the encoder pulse a-phase and b-phase are input to tclka and tclkb. channel 0 operates with tcnt counter clearing by tgr0c compare match; tgr0a and tgr0c are used for the compare match function, and are set with the speed control period and position control period. tgr0b is used for input capture, with tgr0b and tgr0d operating in buffer mode. the channel 1 counter input clock is designated as the tgr0b input capture source, and detection of the pulse width of 2-phase encoder 4-multiplication pulses is performed. tgr1a and tgr1b for channel 1 are designated for input capture, channel 0 tgr0a and tgr0c compare matches are selected as the inpu t capture source, and store the up/down-counter values for the control periods. this procedure enables accurate position/speed detection to be achieved.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 369 of 1108 rej09b0089-0700 tcnt1 tcnt0 channel 1 tgr1a (speed period capture) tgr0a (speed control period) tgr1b (position period capture) tgr0c (position control period) tgr0b (pulse width capture) tgr0d (buffer operation) channel 0 tclka tclkb edge detection circuit + ? + ? figure 9.33 phase counting mode application example 9.5 interrupts 9.5.1 interrupt sou rces and priorities there are three kinds of tpu interrupt source: tgr input capture/compare match, tcnt overflow, and tcnt underflow. each interrupt source has its own status flag and enable/disable bit, allowing generation of interrupt request signals to be enabled or disabled individually. when an interrupt request is generated, the corresponding status flag in tsr is set to 1. if the corresponding enable/disable bit in tier is set to 1 at this time, an interrupt is requested. the interrupt request is cleared by clearing the status flag to 0. relative channel priorities can be changed by the interrupt controller, but the priority order within a channel is fixed. for details, see section 5, interrupt controller.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 370 of 1108 rej09b0089-0700 table 9.13 lists the tpu interrupt sources. table 9.13 tpu interrupts channel interrupt source description dtc activation priority 0 tgi0a tgr0a input capture/compare match possible high tgi0b tgr0b input capture/compare match possible tgi0c tgr0c input capture/compare match possible tgi0d tgr0d input capture/compare match possible tci0v tcnt0 overflow not possible 1 tgi1a tgr1a input capture/compare match possible tgi1b tgr1b input capture/compare match possible tci1v tcnt1 overflow not possible tci1u tcnt1 underflow not possible 2 tgi2a tgr2a input capture/compare match possible tgi2b tgr2b input capture/compare match possible tci2v tcnt2 overflow not possible tci2u tcnt2 underflow not possible 3 tgi3a tgr3a input capture/compare match possible tgi3b tgr3b input capture/compare match possible tgi3c tgr3c input capture/compare match possible tgi3d tgr3d input capture/compare match possible tci3v tcnt3 overflow not possible 4 tgi4a tgr4a input capture/compare match possible tgi4b tgr4b input capture/compare match possible tci4v tcnt4 overflow not possible tci4u tcnt4 underflow not possible 5 tgi5a tgr5a input capture/compare match possible tgi5b tgr5b input capture/compare match possible tci5v tcnt5 overflow not possible tci5u tcnt5 underflow not possible low note: this table shows the initial state immediately after a reset. the relative channel priorities can be changed by the interrupt controller.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 371 of 1108 rej09b0089-0700 input capture/compare match interrupt: an interrupt is requested if the tgie bit in tier is set to 1 when the tgf flag in tsr is set to 1 by the occurrence of a tgr input capture/compare match on a particular channel. the interrupt request is cleared by clearing the tgf flag to 0. the tpu has 16 input capture/compare match interrupts, four each for channels 0 and 3, and two each for channels 1, 2, 4, and 5. overflow interrupt: an interrupt is requested if the tciev bit in tier is set to 1 when the tcfv flag in tsr is set to 1 by the occurrence of tcnt overflow on a channel. the interrupt request is cleared by clearing the tcfv flag to 0. the tpu has six overflow interrupts, one for each channel. underflow interrupt: an interrupt is requested if the tcieu bit in tier is set to 1 when the tcfu flag in tsr is set to 1 by the occurrence of tcnt underflow on a channel. the interrupt request is cleared by clearing the tcfu flag to 0. the tpu has four underflow interrupts, one each for channels 1, 2, 4, and 5. 9.5.2 dtc activation the dtc can be activated by the tgr input capture/compare match interrupt for a channel. for details, see section 7, data transfer controller. a total of 16 tpu input capture/compare match interrupts can be used as dtc activation sources, four each for channels 0 and 3, and two each for channels 1, 2, 4, and 5. 9.5.3 a/d converter activation the a/d converter can be activated by the tgra input capture/compare match for a channel. if the ttge bit in tier is set to 1 when the tgfa flag in tsr is set to 1 by the occurrence of a tgra input capture/compare match on a particular channel, a request to start a/d conversion is sent to the a/d converter. if the tpu conversio n start trigger has been selected on the a/d converter side at this time, a/d conversion is started. in the tpu, a total of six tgra input capture/compare match interrupts can be used as a/d converter conversion start sources, one for each channel.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 372 of 1108 rej09b0089-0700 9.6 operation timing 9.6.1 input/output timing tcnt count timing: figure 9.34 shows tcnt count timing in internal clock operation, and figure 9.35 shows tcnt count timing in external clock operation. tcnt tcnt input clock internal clock n ? 1 n n+1 n+2 falling edge rising edge figure 9.34 count timing in internal clock operation tcnt tcnt input clock external clock n ? 1 n n+1 n+2 rising edge falling edge falling edge figure 9.35 count timing in external clock operation
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 373 of 1108 rej09b0089-0700 output compare output timing: a compare match signal is generated in the final state in which tcnt and tgr match (the point at which the count value matched by tcnt is updated). when a compare match signal is generated, the output value set in tior is output at the output compare output pin. after a match between tcnt and tgr, the compare match signal is not generated until the tcnt input clock is generated. figure 9.36 shows output compare output timing. tgr tcnt tcnt input clock n nn+1 compare match signal tioc pin figure 9.36 output compare output timing input capture signal timing: figure 9.37 shows input capture signal timing. tcnt input capture input n n+1 n+2 n n+2 tgr input capture signal figure 9.37 input capture input signal timing
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 374 of 1108 rej09b0089-0700 timing for counter clearing by compare match/input capture: figure 9.38 shows the timing when counter clearing by compare match occurrence is specified, and figure 9.39 shows the timing when counter clearing by input capture occurrence is specified. tcnt counter clear signal compare match signal tgr n n h'0000 figure 9.38 counter clear timing (compare match) tcnt counter clear signal input capture signal tgr n h'0000 n figure 9.39 counter clear timing (input capture)
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 375 of 1108 rej09b0089-0700 buffer operation timing: figures 9.40 and 9.41 show the timing in buffer operation. tgra, tgrb compare match signal tcnt tgrc, tgrd nn n n n+1 figure 9.40 buffer operation timing (compare match) tgra, tgrb tcnt input capture signal tgrc, tgrd n n nn+1 n n n+1 figure 9.41 buffer operation timing (input capture)
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 376 of 1108 rej09b0089-0700 9.6.2 interrupt signal timing tgf flag setting timing in case of compare match: figure 9.42 shows the timing for setting of the tgf flag in tsr by compare match occurrence, and tgi interrupt request signal timing. tgr tcnt tcnt input clock n nn+1 compare match signal tgf flag tgi interrupt figure 9.42 tgi interrupt timing (compare match)
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 377 of 1108 rej09b0089-0700 tgf flag setting timing in case of input capture: figure 9.43 shows the timing for setting of the tgf flag in tsr by input capture occurrence, and tgi interrupt request signal timing. tgr tcnt input capture signal n n tgf flag tgi interrupt figure 9.43 tgi interrupt timing (input capture)
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 378 of 1108 rej09b0089-0700 tcfv flag/tcfu flag setting timing: figure 9.44 shows the timing for setting of the tcfv flag in tsr by overflow occurrence, and tciv interrupt request signal timing. figure 9.45 shows the timing for setting of the tcfu flag in tsr by underflow occurrence, and tciu interrupt request signal timing. overflow signal tcnt (overflow) tcnt input clock h'ffff h'0000 tcfv flag tciv interrupt figure 9.44 tciv interrupt setting timing underflow signal tcnt (underflow) tcnt input clock h'0000 h'ffff tcfu flag tciu interrupt figure 9.45 tciu interrupt setting timing
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 379 of 1108 rej09b0089-0700 status flag clearing timing: after a status flag is read as 1 by the cpu, it is cleared by writing 0 to it. when the dtc is activated, the flag is cleared automatically. figure 9.46 shows the timing for status flag clearing by the cpu, and figure 9.47 shows the timing for status flag clearing by the dtc. status flag write signal a ddress tsr address interrupt request signal tsr write cycle t 1 t 2 figure 9.46 timing for status flag clearing by cpu interrupt request signal status flag a ddress source address dtc read cycle t 1 t 2 destination address t 1 t 2 dtc write cycle figure 9.47 timing for status flag clearing by dtc activation
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 380 of 1108 rej09b0089-0700 9.7 usage notes note that the kinds of operation and contention described below can occur during tpu operation. input clock restrictions: the input clock pulse width must be at least 1.5 states in the case of single-edge detection, and at least 2.5 states in the case of both-edge detection. the tpu will not operate properly with a narrower pulse width. in phase counting mode, the phase difference and overlap between the two input clocks must be at least 1.5 states, and the pulse width must be at least 2.5 states. figure 9.48 shows the input clock conditions in phase counting mode. overlap phase differ- ence phase differ- ence overlap tclka (tclkc) tclkb (tclkd) pulse width pulse width pulse width pulse width notes: phase difference and overlap pulse width : 1.5 states or more : 2.5 states or more figure 9.48 phase differen ce, overlap, and pulse widt h in phase counting mode caution on period setting: when counter clearing by compare match is set, tcnt is cleared in the final state in which it matches the tgr value (the point at which the count value matched by tcnt is updated). consequently, the actual counter frequency is given by the following formula: f = (n + 1) where f: counter frequency : operating frequency n: tgr set value
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 381 of 1108 rej09b0089-0700 contention between tcnt write and clear operations: if the counter clear signal is generated in the t 2 state of a tcnt write cycle, tcnt clearing takes precedence and the tcnt write is not performed. figure 9.49 shows the timing in this case. counter clear signal write signal a ddress tcnt address tcnt tcnt write cycle t 1 t 2 n h'0000 figure 9.49 contention between tcnt write and clear operations
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 382 of 1108 rej09b0089-0700 contention between tcnt wr ite and increment operations: if incrementing occurs in the t 2 state of a tcnt write cycle, the tcnt write takes precedence and tcnt is not incremented. figure 9.50 shows the timing in this case. tcnt input clock write signal a ddress tcnt address tcnt tcnt write cycle t 1 t 2 n m tcnt write data figure 9.50 contention between t cnt write and increment operations
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 383 of 1108 rej09b0089-0700 contention between tgr write and compare match: if a compare match occurs in the t 2 state of a tgr write cycle, the tgr write takes precedence and the compare match signal is inhibited. a compare match does not occur even if the same value as before is written. figure 9.51 shows the timing in this case. compare match signal write signal a ddress tgr address tcnt tgr write cycle t 1 t 2 n m tgr write data tgr n n+1 prohibited figure 9.51 contention between tgr write and compare match
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 384 of 1108 rej09b0089-0700 contention between buffer register write and compare match: if a compare match occurs in the t 2 state of a tgr write cycle, the data transferred to tgr by the buffer operation will be the data prior to the write. figure 9.52 shows the timing in this case. compare match signal write signal a ddress buffer register address buffer register tgr write cycle t 1 t 2 n tgr n m buffer register write data figure 9.52 contention between bu ffer register write and compare match
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 385 of 1108 rej09b0089-0700 contention between tgr read and input capture: if the input capture signal is generated in the t 1 state of a tgr read cycle, the data that is read will be the data after input capture transfer. figure 9.53 shows the timing in this case. input capture signal read signal a ddress tgr address tgr tgr read cycle t 1 t 2 m internal data bus x m figure 9.53 contention between tgr read and input capture
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 386 of 1108 rej09b0089-0700 contention between tgr write and input capture: if the input capture signal is generated in the t 2 state of a tgr write cycle, the input capture operation takes precedence and the write to tgr is not performed. figure 9.54 shows the timing in this case. input capture signal write signal a ddress tcnt tgr write cycle t 1 t 2 m tgr m tgr address figure 9.54 contention between tgr write and input capture
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 387 of 1108 rej09b0089-0700 contention between buffer regi ster write and input capture: if the input capture signal is generated in the t 2 state of a buffer write cycle, the buffer operation takes precedence and the write to the buffer register is not performed. figure 9.55 shows the timing in this case. input capture signal write signal a ddress tcnt buffer register write cycle t 1 t 2 n tgr n m m buffer register buffer register address figure 9.55 contention between bu ffer register write and input capture
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 388 of 1108 rej09b0089-0700 contention between overflow/u nderflow and co unter clearing: if overflow/underflow and counter clearing occur simultaneously, the tcfv/t cfu flag in tsr is not set and tcnt clearing takes precedence. figure 9.56 shows the operation timing when a tgr compare match is specified as the clearing source, and h'ffff is set in tgr. counter clear signal tcnt input clock tcnt tgf prohibited tcfv flag h'ffff h'0000 figure 9.56 contention between overflow and co unter clearing
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 389 of 1108 rej09b0089-0700 contention between tcnt wr ite and overflo w/underflow: if there is an up-count or down- count in the t 2 state of a tcnt write cycle, and overflow/underflow occurs, the tcnt write takes precedence and the tcfv/tcfu flag in tsr is not set. figure 9.57 shows the operation timing when there is contention between tcnt write and overflow. write signal address tcnt address tcnt tcnt write cycle t 1 t 2 h'ffff m tcnt write data tcfv flag prohibited figure 9.57 contention betw een tcnt write and overflow multiplexing of i/o pins: in the chip, the tclka input pin is multiplexed with the tiocc0 i/o pin, the tclkb input pin with the tiocd0 i/o pin, the tclkc input pin with the tiocb1 i/o pin, and the tclkd input pin with the tiocb2 i/o pin. when an external clock is input, compare match output should not be performed from a multiplexed pin. interrupts and module stop mode: if module stop mode is entered when an interrupt has been requested, it will not be possible to clear the cpu interrupt source or dtc activation source. interrupts should therefore be disabled before entering module stop mode.
section 9 16-bit timer pulse unit (tpu) rev.7.00 feb. 14, 2007 page 390 of 1108 rej09b0089-0700
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 391 of 1108 rej09b0089-0700 section 10 8-bit timers 10.1 overview the chip includes an 8-bit timer module with two channels (tmr0 and tmr1). each channel has an 8-bit counter (tcnt) and two time constant registers (tcora and tcorb) that are constantly compared with the tcnt value to detect compare match events. the 8-bit timer module can thus be used for a variety of functions, including pulse output with an arbitrary duty cycle. 10.1.1 features the features of the 8-bit timer module are listed below. ? selection of four clock sources the counters can be driven by one of three internal clock signals ( /8, /64, or /8192) or an external clock input (enabling use as an external event counter) ? selection of three ways to clear the counters the counters can be cleared on compare match a or b, or by an external reset signal ? timer output control by a combination of two compare match signals the timer output signal in each channel is controlled by a combination of two independent compare match signals, enabling the timer to gene rate output waveforms with an arbitrary duty cycle or pwm output ? provision for cascading of two channels ? operation as a 16-bit timer is possible, using channel 0 for the upper 8 bits and channel 1 for the lower 8 bits (16-bit count mode) ? channel 1 can be used to count channel 0 compare matches (compare match count mode) ? three independent interrupts compare match a and b and overflow interrupts can be requested independently ? a/d converter conversion start trigger can be generated channel 0 compare match a signal can be used as an a/d converter conversion start trigger ? module stop mode can be set as the initial setting, 8-bit timer operation is halted. register access is enabled by exiting module stop mode
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 392 of 1108 rej09b0089-0700 10.1.2 block diagram figure 10.1 shows a block diagram of the 8-bit timer module. external clock sources internal clock sources /8 /64 /8192 clock 1 clock 0 compare match a1 compare match a0 clear 1 cmia0 cmib0 ovi0 cmia1 cmib1 ovi1 interrupt signals tmo0 tmri0 internal bus tcora0 comparator a0 comparator b0 tcorb0 tcsr0 tcr0 tcora1 comparator a1 tcnt1 comparator b1 tcorb1 tcsr1 tcr1 tmci0 tmci1 tcnt0 overflow 1 overflow 0 compare match b1 compare match b0 tmo1 tmri1 a /d conversion start request signal clock select control logic clear 0 figure 10.1 block diagram of 8-bit timer module
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 393 of 1108 rej09b0089-0700 10.1.3 pin configuration table 10.1 summarizes the input and output pins of the 8-bit timer module. table 10.1 input and output pins of 8-bit timer channel name symbol i/o function 0 timer output pin 0 tmo0 output outputs at compare match timer clock input pin 0 tmci0 input inputs external clock for counter timer reset input pin 0 tmri0 input inputs external reset to counter 1 timer output pin 1 tmo1 output outputs at compare match timer clock input pin 1 tmci1 input inputs external clock for counter timer reset input pin 1 tmri1 input inputs external reset to counter 10.1.4 register configuration table 10.2 summarizes the registers of the 8-bit timer module. table 10.2 8-bit timer registers channel name abbreviation r/w initial value address * 1 0 timer control register 0 tcr0 r/w h'00 h'ffb0 timer control/status register 0 tcsr0 r/(w) * 2 h'00 h'ffb2 time constant register a0 tcora0 r/w h'ff h'ffb4 time constant register b0 tcorb0 r/w h'ff h'ffb6 timer counter 0 tcnt0 r/w h'00 h'ffb8 1 timer control register 1 tcr1 r/w h'00 h'ffb1 timer control/status register 1 tcsr1 r/(w) * 2 h'10 h'ffb3 time constant register a1 tcora1 r/w h'ff h'ffb5 time constant register b1 tcorb1 r/w h'ff h'ffb7 timer counter 1 tcnt1 r/w h'00 h'ffb9 all module stop control register mstpcr r/w h'3fff h'ff3c notes: 1. lower 16 bits of the address 2. only 0 can be written to bits 7 to 5, to clear these flags. each pair of registers for channel 0 and channel 1 is a 16-bit register with the upper 8 bits for channel 0 and the lower 8 bits for channel 1, so th ey can be accessed together by a word transfer instruction.
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 394 of 1108 rej09b0089-0700 10.2 register descriptions 10.2.1 timer counters 0 and 1 (tcnt0, tcnt1) tcnt0 tcnt1 bit : 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value : 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w tcnt0 and tcnt1 are 8-bit readable/writable up-counters that increment on pulses generated from an internal or external clock source. this cl ock source is selected by clock select bits cks2 to cks0 in tcr. the cpu can read or write to tcnt0 and tcnt1 at all times. tcnt0 and tcnt1 comprise a single 16-bit register, so they can be accessed together by a word transfer instruction. tcnt0 and tcnt1 can be cleared by an external reset input or by a compare match signal. which signal is to be used for clearing is select ed by clock clear bits cclr1 and cclr0 in tcr. when a timer counter overflows from h'ff to h'00, ovf in tcsr is set to 1. tcnt0 and tcnt1 are each initialized to h'00 by a reset and in hardware standby mode. 10.2.2 time constant registers a0 and a1 (tcora0, tcora1) tcora0 tcora1 bit : 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value : 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w : r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w tcora0 and tcora1 are 8-bit readable/writable registers. tcora0 and tcora1 comprise a single 16-bit register so they can be accessed together by a word transfer instruction. tcora is continually compared with the value in tcnt. when a match is detected, the corresponding cmfa flag in tcsr is set. note, however, that comparison is disabled during the t 2 state of a tcor write cycle.
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 395 of 1108 rej09b0089-0700 the timer output can be freely controlled by these compare match signals and the settings of bits os1 and os0 in tcsr. tcora0 and tcora1 are each initialized to h'ff by a reset and in hardware standby mode. 10.2.3 time constant registers b0 and b1 (tcorb0, tcorb1) tcorb0 tcorb1 bit : 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value : 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w : r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w tcorb0 and tcorb1 are 8-bit readable/writable registers. tcorb0 and tcorb1 comprise a single 16-bit register so they can be accessed together by a word transfer instruction. tcorb is continually compared with the value in tcnt. when a match is detected, the corresponding cmfb flag in tcsr is set. note, however, that comparison is disabled during the t 2 state of a tcor write cycle. the timer output can be freely controlled by these compare match signals and the settings of output select bits os3 and os2 in tcsr. tcorb0 and tcorb1 are each initialized to h'ff by a reset and in hardware standby mode. 10.2.4 time control registers 0 and 1 (tcr0, tcr1) bit : 7 6 5 4 3 2 1 0 cmieb cmiea ovie cclr1 cclr0 cks2 cks1 cks0 initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w tcr0 and tcr1 are 8-bit readable/writable registers that select the clock source and the time at which tcnt is cleared, and enable interrupts. tcr0 and tcr1 are each initialized to h'00 by a reset and in hardware standby mode. for details of this timing, see section 10.3, operation.
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 396 of 1108 rej09b0089-0700 bit 7?compare match interrupt enable b (cmieb): selects whether cmfb interrupt requests (cmib) are enabled or disabled when the cmfb flag in tcsr is set to 1. bit 7 cmieb description 0 cmfb interrupt requests (cmib) are disabled (initial value) 1 cmfb interrupt requests (cmib) are enabled bit 6?compare match interrupt enable a (cmiea): selects whether cmfa interrupt requests (cmia) are enabled or disabled when the cmfa flag in tcsr is set to 1. bit 6 cmiea description 0 cmfa interrupt requests (cmia) are disabled (initial value) 1 cmfa interrupt requests (cmia) are enabled bit 5?timer overflow interrupt enable (ovie): selects whether ovf interrupt requests (ovi) are enabled or disabled when the ovf flag in tcsr is set to 1. bit 5 ovie description 0 ovf interrupt requests (ovi) are disabled (initial value) 1 ovf interrupt requests (ovi) are enabled bits 4 and 3?counter clear 1 and 0 (cclr1 and cclr0): these bits select the method by which tcnt is cleared: by compare match a or b, or by an external reset input. bit 4 cclr1 bit 3 cclr0 description 0 0 clearing is disabled (initial value) 1 clear by compare match a 1 0 clear by compare match b 1 clear by rising edge of external reset input bits 2 to 0?clock select 2 to 0 (cks2 to cks0): these bits select whether the clock input to tcnt is an internal or external clock. three internal clocks can be selected, all divided from the system clock ( ): /8, /64, and /8192. the falling edge of the selected internal clock triggers the count.
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 397 of 1108 rej09b0089-0700 when use of an external clock is selected, three ty pes of count can be selected: at the rising edge, the falling edge, and both rising and falling edges. some functions differ between channel 0 and channel 1. bit 2 cks2 bit 1 cks1 bit 0 cks0 description 0 0 0 clock input disabled (initial value) 1 internal clock, counted at falling edge of /8 1 0 internal clock, counted at falling edge of /64 1 internal clock, counted at falling edge of /8192 1 0 0 for channel 0: count at tcnt1 overflow signal * for channel 1: count at tcnt0 compare match a * 1 external clock, counted at rising edge 1 0 external clock, counted at falling edge 1 external clock, counted at both rising and falling edges note: * if the count input of channel 0 is the tcnt1 overflow signal and that of channel 1 is the tcnt0 compare match signal, no incrementing clock is generated. do not use this setting. 10.2.5 timer control/status registers 0 and 1 (tcsr0, tcsr1) tcsr0 bit : 7 6 5 4 3 2 1 0 cmfb cmfa ovf adte os3 os2 os1 os0 initial value : 0 0 0 0 0 0 0 0 r/w : r/(w) * r/(w) * r/(w) * r/w r/w r/w r/w r/w tcsr1 bit : 7 6 5 4 3 2 1 0 cmfb cmfa ovf ? os3 os2 os1 os0 initial value : 0 0 0 1 0 0 0 0 r/w : r/(w) * r/(w) * r/(w) * ? r/w r/w r/w r/w note: * only 0 can be written to bits 7 to 5, to clear these flags.
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 398 of 1108 rej09b0089-0700 tcsr0 and tcsr1 are 8-bit registers that display compare match and overflow statuses, and control compare match output. tcsr0 is initialized to h'00, and tcsr1 to h'10, by a reset and in hardware standby mode. bit 7?compare match flag b (cmfb): status flag indicating whether the values of tcnt and tcorb match. bit 7 cmfb description 0 [clearing conditions] (initial value) ? cleared by reading cmfb when cmfb = 1, then writing 0 to cmfb ? when dtc is activated by cmib interr upt while disel bit of mrb in dtc is 0 1 [setting condition] set when tcnt matches tcorb bit 6?compare match flag a (cmfa): status flag indicating whether the values of tcnt and tcora match. bit 6 cmfa description 0 [clearing conditions] (initial value) ? cleared by reading cmfa when cmfa = 1, then writing 0 to cmfa ? when dtc is activated by cmia interr upt while disel bit of mrb in dtc is 0 1 [setting condition] set when tcnt matches tcora bit 5?timer overflow flag (ovf): status flag indicating that tcnt has overflowed (changed from h'ff to h'00). bit 5 ovf description 0 [clearing condition] (initial value) cleared by reading ovf when ovf = 1, then writing 0 to ovf 1 [setting condition] set when tcnt overflows from h'ff to h'00
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 399 of 1108 rej09b0089-0700 bit 4?a/d trigger enable (adte) (tcsr0 only): selects enabling or disabling of a/d converter start requests by compare match a. in tcsr1, this bit is reserved: it is always read as 1 and cannot be modified. bit 4 adte description 0 a/d converter start requests by compare match a are disabled (initial value) 1 a/d converter start requests by compare match a are enabled bits 3 to 0?output select 3 to 0 (os3 to os0): these bits specify how the timer output level is to be changed by a compare match of tcor and tcnt. bits os3 and os2 select the effect of compare match b on the output level, bits os1 and os0 select the effect of compare match a on the output level, and both of them can be controlled independently. note, however, that priorities are set such that: toggle output > 1 output > 0 output. if compare matches occur simultaneously, the output changes according to the compare match with the higher priority. timer output is disabled when bits os3 to os0 are all 0. after a reset, the timer output is 0 until the first compare match event occurs. bit 3 os3 bit 2 os2 description 0 0 no change when compare match b occurs (initial value) 1 0 is output when compare match b occurs 1 0 1 is output when compare match b occurs 1 output is inverted when compare match b occurs (toggle output) bit 1 os1 bit 0 os0 description 0 0 no change when compare match a occurs (initial value) 1 0 is output when compare match a occurs 1 0 1 is output when compare match a occurs 1 output is inverted when compare match a occurs (toggle output)
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 400 of 1108 rej09b0089-0700 10.2.6 module stop control register (mstpcr) mstpcrh mstpcrl bit : 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value : 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w : r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w mstpcr is a 16-bit readable/writable register that performs module stop mode control. when the mstp12 bit in mstpcr is set to 1, the 8-bit timer operation stops at the end of the bus cycle and a transition is made to module stop mode . registers cannot be read or written to in module stop mode. for details, see section 19.5, module stop mode. mstpcr is initialized to h'3fff by a reset and in ha rdware standby mode. it is not initialized in software standby mode. bit 12?module stop (mstp12): specifies the 8-bit timer module stop mode. bit 12 mstp12 description 0 8-bit timer module stop mode cleared 1 8-bit timer module stop mode set (initial value)
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 401 of 1108 rej09b0089-0700 10.3 operation 10.3.1 tcnt incrementation timing tcnt is incremented by input clock pu lses (either internal or external). internal clock: three different internal clock signals ( /8, /64, or /8192) divided from the system clock ( ) can be selected, by setting bits cks2 to cks0 in tcr. figure 10.2 shows the count timing. internal clock clock input to tcnt tcnt n ? 1 n n+1 figure 10.2 count timing for internal clock input external clock: three incrementation methods can be selected by setting bits cks2 to cks0 in tcr: at the rising edge, the falling edge, and both rising and falling edges. note that the external clock pulse width must be at least 1.5 states for incrementation at a single edge, and at least 2.5 states for incrementation at both edges. the counter will not increment correctly if the pulse width is less than these values. figure 10.3 shows the timing of incrementation at both edges of an external clock signal.
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 402 of 1108 rej09b0089-0700 external clock input pin clock input to tcnt tcnt n ? 1 n n+1 figure 10.3 count timing for external clock input 10.3.2 compare match timing setting of compare match flags a and b (cmfa, cmfb): the cmfa and cmfb flags in tcsr are set to 1 by a compare match signal generated when the tcor and tcnt values match. the compare match signal is generated at the last state in which the match is true, just before the timer counter is updated. therefore, when tcor and tcnt match, the compare match signal is not generated until the next incrementation clock input. figure 10.4 shows this timing. tcnt n n+1 tcor n compare match signal cmf figure 10.4 timing of cmf setting
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 403 of 1108 rej09b0089-0700 timer output timing: when compare match a or b occurs, the timer output changes as specified by bits os3 to os0 in tcsr. dependin g on these bits, the output can remain the same, change to 0, change to 1, or toggle. figure 10.5 shows the timing when the output is set to toggle at compare match a. compare match a signal timer output pin figure 10.5 timing of timer output timing of compare match clear: the timer counter is cleared when compare match a or b occurs, depending on the setting of the cclr1 and cclr0 bits in tcr. figure 10.6 shows the timing of this operation. n h'00 compare match signal tcnt figure 10.6 timing of compare match clear
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 404 of 1108 rej09b0089-0700 10.3.3 timing of tcnt external reset tcnt is cleared at the rising edge of an external reset input, depending on the settings of the cclr1 and cclr0 bits in tcr. the clear pulse width must be at least 1.5 states. figure 10.7 shows the timing of this operation. clear signal external reset input pin tcnt n h'00 n ? 1 figure 10.7 timing of cl earance by external reset 10.3.4 timing of overflow flag (ovf) setting the ovf in tcsr is set to 1 when tcnt overflows (changes from h'ff to h'00). figure 10.8 shows the timing of this operation. ovf overflow signal tcnt h'ff h'00 figure 10.8 timing of ovf setting
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 405 of 1108 rej09b0089-0700 10.3.5 operation with cascaded connection if bits cks2 to cks0 in either tcr0 or tcr1 are set to b'100, the 8-bit timers of the two channels are cascaded. with this configuration, a single 16-bit timer could be used (16-bit counter mode) or compare matches of the 8-bit channel 0 could be counted by the timer of channel 1 (compare match counter mode). in this case, the timer operates as below. 16-bit counter mode: when bits cks2 to cks0 in tcr0 are set to b'100, the timer functions as a single 16-bit timer with channel 0 occupying the upper 8 bits and channel 1 occupying the lower 8 bits. ? setting of compare match flags ? the cmf flag in tcsr0 is set to 1 when a 16-bit compare match event occurs. ? the cmf flag in tcsr1 is set to 1 when a lower 8-bit compare match event occurs. ? counter clear specification ? if the cclr1 and cclr0 bits in tcr0 have been set for counter clear at compare match, the 16-bit counter (tcnt0 and tcnt1 together) is cleared when a 16-bit compare match event occurs. the 16-bit counter (tcnt0 and tcnt1 together) is cleared even if counter clear by the tmri0 pin has also been set. ? the settings of the cclr1 and cclr0 bits in tcr1 are ignored. the lower 8 bits cannot be cleared independently. ? pin output ? control of output from the tmo0 pin by bits os3 to os0 in tcsr0 is in accordance with the 16-bit compare match conditions. ? control of output from the tmo1 pin by bits os3 to os0 in tcsr1 is in accordance with the lower 8-bit compare match conditions. compare match counter mode: when bits cks2 to cks0 in tcr1 are b'100, tcnt1 counts compare match a?s for channel 0. channels 0 and 1 are controlled independently. conditions such as setting of the cmf flag, generation of interrupts, output from the tmo pin, and counter clear are in accordance with the settings for each channel. usage note: if the 16-bit counter mode and compare match counter mode are set simultaneously, the input clock pulses for tcnt0 and tcnt1 are not generated and thus the counters will stop operating. software should therefore avoid using both these modes.
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 406 of 1108 rej09b0089-0700 10.4 interrupts 10.4.1 interrupt sources and dtc activation there are three 8-bit timer interrupt sources: cm ia, cmib, and ovi. their relative priorities are shown in table 10.3. each interrupt source is set as enabled or disabled by the corresponding interrupt enable bit in tcr, and independent interrupt requests are sent for each to the interrupt controller. it is also possible to activate the dtc by means of cmia and cmib interrupts. table 10.3 8-bit timer interrupt sources channel interrupt source description dtc activation priority 0 cmia0 interrupt by cmfa possible high cmib0 interrupt by cmfb possible ovi0 interrupt by ovf not possible 1 cmia1 interrupt by cmfa possible cmib1 interrupt by cmfb possible ovi1 interrupt by ovf not possible low note: this table shows the initial state immediately after a reset. the relative channel priorities can be changed by the interrupt controller. 10.4.2 a/d converter activation the a/d converter can be activated only by channel 0 compare match a. if the adte bit in tcsr0 is set to 1 when the cmfa flag is set to 1 by the occurrence of channel 0 compare match a, a request to start a/d conversion is sent to the a/d converter. if the 8-bit timer conversion start trigger has been selected on the a/d converter side at this time, a/d conversion is started.
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 407 of 1108 rej09b0089-0700 10.5 sample application in the example below, the 8-bit timer is used to generate a pulse output with a selected duty cycle, as shown in figure 10.9. the control bits are set as follows: [1] in tcr, bit cclr1 is cleared to 0 and bit cclr0 is set to 1 so that the timer counter is cleared when its value matches the constant in tcora. [2] in tcsr, bits os3 to os0 are set to b'0110, causing the output to change to 1 at a tcora compare match and to 0 at a tcorb compare match. with these settings, the 8-bit timer provides output of pulses at a rate determined by tcora with a pulse width determined by tcorb. no software intervention is required. tcnt h'ff counter clear tcora tcorb h'00 tmo figure 10.9 example of pulse output
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 408 of 1108 rej09b0089-0700 10.6 usage notes note that the following kinds of contention can occur in the 8-bit timer module. 10.6.1 contention between tcnt write and clear if a timer counter clock pulse is generated during the t 2 state of a tcnt write cycle, the clear takes priority, so that the counter is cleared and the write is not performed. figure 10.10 shows this operation. a ddress tcnt address internal write signal counter clear signal tcnt n h'00 t 1 t 2 tcnt write cycle by cpu figure 10.10 contention be tween tcnt write and clear
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 409 of 1108 rej09b0089-0700 10.6.2 contention between tcnt write and increment if a timer counter clock pulse is generated during the t 2 state of a tcnt write cycle, the write takes priority and the counter is not incremented. figure 10.11 shows this operation. a ddress tcnt address internal write signal tcnt input clock tcnt nm t 1 t 2 tcnt write cycle by cpu counter write data figure 10.11 contention betw een tcnt write and increment
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 410 of 1108 rej09b0089-0700 10.6.3 contention between tcor write and compare match during the t 2 state of a tcor write cycle, the tcor write has priority and the compare match signal is inhibited even if a compare match event occurs. figure 10.12 shows this operation. a ddress tcor address internal write signal tcnt tcor nm t 1 t 2 tcor write cycle by cpu tcor write data n n+1 compare match signal inhibited figure 10.12 contention between tcor write and compare match
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 411 of 1108 rej09b0089-0700 10.6.4 contention between compare matches a and b if compare match events a and b occur at the same time, the 8-bit timer operates in accordance with the priorities for the output statuses set for compare match a and compare match b, as shown in table 10.4. table 10.4 timer output priorities output setting priority toggle output high 1 output 0 output no change low 10.6.5 switching of internal clocks and tcnt operation tcnt may increment erroneously when the internal clock is switched over. table 10.5 shows the relationship between the timing at which the internal clock is switched (by writing to the cks1 and cks0 bits) and the tcnt operation. when the tcnt clock is generated from an internal clock, the falling edge of the internal clock pulse is detected. if clock switching causes a change from high to low level, as shown in case 3 in table 10.5, a tcnt clock pulse is generated on the assumption that the switchover is a falling edge. this increments tcnt. the erroneous incrementation can also happen when switching between internal and external clocks.
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 412 of 1108 rej09b0089-0700 table 10.5 switching of internal clock and tcnt operation no. timing of switchover by means of cks1 and cks0 bits tcnt clock operation 1 switching from low to low * 1 clock before switchover clock after switchover tcnt clock tcnt cks bit write n n+1 2 switching from low to high * 2 clock before switchover clock after switchover tcnt clock tcnt cks bit write n n+1 n+2 3 switching from high to low * 3 clock before switchover clock after switchover tcnt clock tcnt cks bit write n n+1 n+2 * 4
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 413 of 1108 rej09b0089-0700 no. timing of switchover by means of cks1 and cks0 bits tcnt clock operation 4 switching from high to high clock before switchover clock after switchover tcnt clock tcnt cks bit write n n+1 n+2 notes: 1. includes switching from low to stop, and from stop to low. 2. includes switching from stop to high. 3. includes switching from high to stop. 4. generated on the assumption that the switchover is a falling edge; tcnt is incremented. 10.6.6 interrupts and module stop mode if module stop mode is entered when an interrupt has been requested, it will not be possible to clear the cpu interrupt source or the dtc activation source. interrupts should therefore be disabled before entering module stop mode.
section 10 8-bit timers rev.7.00 feb. 14, 2007 page 414 of 1108 rej09b0089-0700
section 11 watchdog timer rev.7.00 feb. 14, 2007 page 415 of 1108 rej09b0089-0700 section 11 watchdog timer 11.1 overview the chip has a single-channel on-chip watchdog timer (wdt) for monitoring system operation. the wdt outputs an overflow signal ( wdtovf ) * if a system crash prevents the cpu from writing to the timer counter, allowing it to overflow. at the same time, the wdt can also generate an internal reset signal for the chip. when this watchdog function is not needed, the wdt can be used as an interval timer. in interval timer operation, an interval timer interrupt is generated each time the counter overflows. note: * the wdtovf function is not available in the f-ztat versions. 11.1.1 features wdt features are listed below. ? switchable between watchdog timer mode and interval timer mode ? wdtovf output when in watchdog timer mode * if the counter overflows, the wdt outputs wdtovf . it is possible to select whether or not the entire chip is reset at the same time ? interrupt generation when in interval timer mode if the counter overflows, the wdt generates an interval timer interrupt ? choice of eight counter clock sources note: * the wdtovf function is not available in the f-ztat versions.
section 11 watchdog timer rev.7.00 feb. 14, 2007 page 416 of 1108 rej09b0089-0700 11.1.2 block diagram figure 11.1 shows a block diagram of the wdt. overflow interrupt control wovi (interrupt request signal) wdtovf * 1 internal reset signal * 2 reset control rstcsr tcnt tscr /2 /64 /128 /512 /2048 /8192 /32768 /131072 clock clock select internal clock sources bus interface module bus legend: tcsr: tcnt: rstcsr: notes: timer control/status register timer counter reset control/status register internal bus wdt 1. the wdtovf output function is not available in the f-ztat versions. 2. internal reset signal generation is specified by means of a register setting. figure 11.1 block diagram of wdt
section 11 watchdog timer rev.7.00 feb. 14, 2007 page 417 of 1108 rej09b0089-0700 11.1.3 pin configuration table 11.1 describes the wdt output pin. table 11.1 wdt pin name symbol i/o function watchdog timer overflow wdtovf * output outputs counter overflow signal in watchdog timer mode note: * the wdtovf function is not available in the f-ztat versions. 11.1.4 register configuration the wdt has three registers, as summarized in ta ble 11.2. these registers control clock selection, wdt mode switching, and the reset signal. table 11.2 wdt registers address * 1 name abbreviation r/w initial value write * 2 read timer control/status register tcsr r/(w) * 3 h'18 h'ffbc h'ffbc timer counter tcnt r/w h'00 h'ffbc h'ffbd reset control/status register rstcsr r/(w) * 3 h'1f h'ffbe h'ffbf notes: 1. lower 16 bits of the address. 2. for details of write operations, see section 11.2.4, notes on register access. 3. only a write of 0 is permitted to bit 7, to clear the flag.
section 11 watchdog timer rev.7.00 feb. 14, 2007 page 418 of 1108 rej09b0089-0700 11.2 register descriptions 11.2.1 timer counter (tcnt) bit : 7 6 5 4 3 2 1 0 initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w tcnt is an 8-bit readable/writable * 1 up-counter. when the tme bit is set to 1 in tcsr, tcnt star ts counting pulses generated from the internal clock source selected by bits cks2 to cks0 in tcsr. when the count overflows (changes from h'ff to h'00), either the watchdog timer overflow signal ( wdtovf ) * 2 or an interval timer interrupt (wovi) is generated, depending on the mode selected by the wt/ it bit in tcsr. tcnt is initialized to h'00 by a reset, in hardware standby mode, or when the tme bit is cleared to 0. it is not initialized in software standby mode. notes: 1. tcnt is write-protected by a passwo rd to prevent accidental overwriting. for details see section 11.2.4, notes on register access. 2. the wdtovf function is not available in the f-ztat versions.
section 11 watchdog timer rev.7.00 feb. 14, 2007 page 419 of 1108 rej09b0089-0700 11.2.2 timer control/status register (tcsr) bit : 7 6 5 4 3 2 1 0 ovf wt/ it tme ? ? cks2 cks1 cks0 initial value : 0 0 0 1 1 0 0 0 r/w : r/(w) * r/w r/w ? ? r/w r/w r/w note: * only 0 can be written, to clear the flag. tcsr is an 8-bit readable/writable * register. its functions include selecting the clock source to be input to tcnt, and the timer mode. tcr is initialized to h'18 by a reset and in hardware standby mode. it is not initialized in software standby mode. note: * tcsr is write-protected by a password to prevent accidental overwriting. for details see section 11.2.4, notes on register access. bit 7?overflow flag (ovf): indicates that tcnt has overflowed from h'ff to h'00, when in interval timer mode. this flag cannot be set during watchdog timer operation. bit 7 ovf description 0 [clearing condition] (initial value) cleared by reading tcsr when ovf = 1 * , then writing 0 to ovf 1 [setting condition] set when tcnt overflows (changes from h'ff to h'00) in interval timer mode note: * when ovf is polled and the interval timer interrupt is disabled, ovf = 1 must be read at least twice. bit 6?timer mode select (wt/ it ): selects whether the wdt is used as a watchdog timer or interval timer. if used as an interval timer, the wdt generates an interval timer interrupt request (wovi) when tcnt overflows. if used as a watchdog timer, the wdt generates the wdtovf signal * 1 when tcnt overflows.
section 11 watchdog timer rev.7.00 feb. 14, 2007 page 420 of 1108 rej09b0089-0700 bit 6 wt/ it description 0 interval timer: sends the cpu an interval timer interrupt request (wovi) when tcnt overflows (initial value) 1 watchdog timer: generates the wdtovf signal * 1 when tcnt overflows * 2 notes: 1. the wdtovf function is not available in the f-ztat versions. 2. for details of the case where tcnt overflows in watchdog timer mode, see section 11.2.3, reset control/status register (rstcsr). bit 5?timer enable (tme): selects whether tcnt runs or is halted. bit 5 tme description 0 tcnt is initialized to h'00 and halted (initial value) 1 tcnt counts bits 4 and 3?reserved: these bits cannot be modified and are always read as 1. bits 2 to 0?clock select 2 to 0 (cks2 to cks0): these bits select one of eight internal clock sources, obtained by dividing the system clock ( ), for input to tcnt. description bit 2 cks2 bit 1 cks1 bit 0 cks0 clock overflow period (when = 20 mhz) * 0 0 0 /2 (initial value) 25.6 s 1 /64 819.2 s 1 0 /128 1.6 ms 1 /512 6.6 ms 1 0 0 /2048 26.2 ms 1 /8192 104.9 ms 1 0 /32768 419.4 ms 1 /131072 1.68 s note: * the overflow period is the time from when t cnt starts counting up from h'00 until overflow occurs.
section 11 watchdog timer rev.7.00 feb. 14, 2007 page 421 of 1108 rej09b0089-0700 11.2.3 reset control/status register (rstcsr) bit : 7 6 5 4 3 2 1 0 wovf rste ? ? ? ? ? ? initial value : 0 0 0 1 1 1 1 1 r/w : r/(w) * r/w r/w ? ? ? ? ? note: * only 0 can be written, to clear the flag. rstcsr is an 8-bit readable/writable * register that controls the generation of the internal reset signal when tcnt overflows, and selects the type of internal reset signal. rstcsr is initialized to h'1f by a reset signal from the res pin, but not by the wdt internal reset signal caused by overflows. note: * rstcsr is write-protected by a password to prevent accidental overwriting. for details see section 11.2.4, notes on register access. bit 7?watchdog timer overflow flag (wovf): indicates that tcnt has overflowed (changed from h'ff to h'00) during watchdog timer operation. this bit is not set in interval timer mode. bit 7 wovf description 0 [clearing condition] (initial value) cleared by reading rstcsr when wovf = 1, then writing 0 to wovf 1 [setting condition] set when tcnt overflows (changes from h'ff to h'00) during watchdog timer operation bit 6?reset enable (rste): specifies whether or not a reset signal is generated in the chip if tcnt overflows during watchdog timer operation. bit 6 rste description 0 reset signal is not generated if tcnt overflows * (initial value) 1 reset signal is generated if tcnt overflows note: * the modules within the chip are not reset, but tcnt and tcsr within the wdt are reset.
section 11 watchdog timer rev.7.00 feb. 14, 2007 page 422 of 1108 rej09b0089-0700 bit 5?reserved: this bit should be written with 0. bits 4 to 0?reserved: these bits cannot be modified and are always read as 1. 11.2.4 notes on register access the watchdog timer?s tcnt, tcsr, and rstcsr registers differ from other registers in being more difficult to write to. the procedures for writing to and reading these registers are given below. writing to tcnt and tcsr: these registers must be written to by a word transfer instruction. they cannot be written to with byte instructions. figure 11.2 shows the format of data written to tcnt and tcsr. tcnt and tcsr both have the same write address. for a write to tcnt, the upper byte of the written word must contain h'5a and the lower byte must contain the write data. for a write to tcsr, the upper byte of the written word must contain h'a5 and the lower byte must contain the write data. this transfers the write data from the lower byte to tcnt or tcsr. tcnt write tcsr write address: h'ffbc address: h'ffbc h'5a write data 15 8 7 0 h'a5 write data 15 8 7 0 figure 11.2 writing to tcnt and tcsr writing to rstcsr: rstcsr must be written to by a word transfer instruction to address h'ffbe. it cannot be written to with byte instructions. figure 11.3 shows the format of data written to rstcsr. the method of writing 0 to the wovf bit differs from that for writing to the rste bit. to write 0 to the wovf bit, the write data must have h'a5 in the upper byte and h'00 in the lower byte. this clears the wovf bit to 0, but has no effect on the rste bit. to write to the rste bit, the upper byte must contain h'5a and the lower byte must contain the write data. this writes the value in bit 6 of the lower byte into the rste bit, but has no effect on the wovf bit.
section 11 watchdog timer rev.7.00 feb. 14, 2007 page 423 of 1108 rej09b0089-0700 h'a5 h'00 15 8 7 0 h'5a write data 15 8 7 0 writing 0 to wovf bit writing to rste bit address: h'ffbe address: h'ffbe figure 11.3 writing to rstcsr reading tcnt, tcsr, and rstcsr: these registers are read in the same way as other registers. the read addresses are h'ffbc for tcsr, h'ffbd for tcnt, and h'ffbf for rstcsr. 11.3 operation 11.3.1 operation in watchdog timer mode to use the wdt as a watchdog timer, set the wt/ it and tme bits to 1. software must prevent tcnt overflows by rewriting the tcnt value (normally be writing h'00) before overflow occurs. this ensures that tcnt does not overflow while the system is operating normally. if tcnt overflows without being rewritten because of a system crash or other error, the wdtovf signal * is output. this is shown in figure 11.4. this wdtovf signal * can be used to reset the system. the wdtovf signal * is output for 132 states when rste = 1, and for 130 states when rste = 0. if tcnt overflows when 1 is set in the rste bit in rstcsr, a signal that resets the chip internally is generated at the same time as the wdtovf signal * . the internal reset signal is output for 518 states. if a reset caused by a signal input to the res pin occurs at the same time as a reset caused by a wdt overflow, the res pin reset has priority and the wovf bit in rstcsr is cleared to 0. note: * the wdtovf function is not available in the f-ztat versions.
section 11 watchdog timer rev.7.00 feb. 14, 2007 page 424 of 1108 rej09b0089-0700 tcnt count h'00 time h'ff wt/ it =1 tme=1 h'00 written to tcnt wt/ it =1 tme=1 h'00 written to tcnt 132 states * 2 518 states wdtovf signal * 3 internal reset signal * 1 wt/ it : tme: notes: 1. the internal reset signal is generated only if the rste bit is set to 1. 2. 130 states when the rste bit is cleared to 0. 3. the wdtovf output function is not available in the f-ztat versions. overflow wdtovf * 3 and internal reset are generated wovf=1 timer mode select bit timer enable bit legend: figure 11.4 operation in watchdog timer mode
section 11 watchdog timer rev.7.00 feb. 14, 2007 page 425 of 1108 rej09b0089-0700 11.3.2 operation in interval timer mode to use the wdt as an interval timer, clear the wt/ it bit in tcsr to 0 and set the tme bit to 1. an interval timer interrupt (wovi) is generated each time tcnt overflows, provided that the wdt is operating as an interval timer, as shown in figure 11.5. this function can be used to generate interrupt requests at regular intervals. tcnt count h'00 time h'ff wt/ it =0 tme=1 wovi overflow overflow overflow overflow legend wovi: interval timer interrupt request generation wovi wovi wovi figure 11.5 operation in interval timer mode
section 11 watchdog timer rev.7.00 feb. 14, 2007 page 426 of 1108 rej09b0089-0700 11.3.3 timing of overflow flag (ovf) setting the ovf flag is set to 1 if tcnt overflows during interval timer operation. at the same time, an interval timer interrupt (wovi) is requested. this timing is shown in figure 11.6. tcnt h'ff h'00 overflow signal (internal signal) ovf figure 11.6 timing of ovf setting
section 11 watchdog timer rev.7.00 feb. 14, 2007 page 427 of 1108 rej09b0089-0700 11.3.4 timing of watchdog timer overflow flag (wovf) setting the wovf flag is set to 1 if tcnt overflows during watchdog timer operation. at the same time, the wdtovf signal * goes low. if tcnt overflows while the rste bit in rstcsr is set to 1, an internal reset signal is generated for the entire chip. figure 11.7 shows the timing in this case. note: * the wdtovf output function is not available in the f-ztat versions. tcnt note: * the wdtovf output function is not available in the f-ztat versions. h'ff h'00 overflow signal (internal signal) wovf wdtovf signal * internal reset signal 132 states 518 states figure 11.7 timing of wovf setting
section 11 watchdog timer rev.7.00 feb. 14, 2007 page 428 of 1108 rej09b0089-0700 11.4 interrupts during interval timer mode operation, an overflow generates an interval timer interrupt (wovi). the interval timer interrupt is requested wh enever the ovf flag is set to 1 in tcsr. 11.5 usage notes 11.5.1 contention between timer counter (tcnt) write and increment if a timer counter clock pulse is generated during the t 2 state of a tcnt write cycle, the write takes priority and the timer counter is not incremented. figure 11.8 shows this operation. a ddress internal write signal tcnt input clock tcnt nm t 1 t 2 tcnt write cycle counter write data figure 11.8 contention betw een tcnt write and increment
section 11 watchdog timer rev.7.00 feb. 14, 2007 page 429 of 1108 rej09b0089-0700 11.5.2 changing value of cks2 to cks0 if bits cks2 to cks0 in tcsr are written to while the wdt is operating, errors may occur in the incrementation. software must stop the watchdog timer (by clearing the tme bit to 0) before changing the value of bits cks2 to cks0. 11.5.3 switching between watchdog timer mode and interval timer mode if the mode is switched from watchdog timer to interval timer, or vice versa, while the wdt is operating, errors may occur in the incrementation. software must stop the watchdog timer (by clearing the tme bit to 0) before switching the mode. 11.5.4 system reset by wdtovf signal * if the wdtovf output signal * is input to the res pin of the chip, the chip will not be initialized correctly. make sure that the wdtovf signal * is not input logically to the res pin. to reset the entire system by means of the wdtovf signal * , use the circuit shown in figure 11.9. note: * the wdtovf output function is not available in the f-ztat versions. reset input reset signal to entire system chip res wdtovf * note: * the wdtovf output function is not available in f-ztat versions. figure 11.9 circuit for system reset by wdtovf signal (example)
section 11 watchdog timer rev.7.00 feb. 14, 2007 page 430 of 1108 rej09b0089-0700 11.5.5 internal reset in watchdog timer mode the chip is not reset internally if tcnt overflows while the rste bit is cleared to 0 during watchdog timer operation, but tcnt and tscr of the wdt are reset. tcnt, tcsr, and rstcr cannot be written to while the wdtovf signal * is low. also note that a read of the wovf flag is not recognized during this period. to clear the wovf flag, therefore, read rstcsr after the wdtovf signal * goes high, then write 0 to the wovf flag. note: * the wdtovf output function is not available in the f-ztat versions.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 431 of 1108 rej09b0089-0700 section 12 serial communication interface (sci) 12.1 overview the chip is equipped with a serial communi cation interface (sci) that can handle both asynchronous and synchronous serial communication. a function is also provided for serial communication between processors (multiprocessor communication function). 12.1.1 features sci features are listed below. ? choice of asynchronous or synchronous serial communication mode asynchronous mode ? serial data communication executed using an asynchronous system in which synchronization is achieved character by character ? serial data communication can be carried ou t with standard asynchronous communication chips such as a universal asynchronous receiver/transmitter (uart) or asynchronous communication interface adapter (acia) ? a multiprocessor communication function is provided that enables serial data communication with a number of processors ? choice of 12 serial data transfer formats data length : 7 or 8 bits stop bit length : 1 or 2 bits parity : even, odd, or none multiprocessor bit : 1 or 0 ? receive error detection : parity, overrun, and framing errors ? break detection : break can be detected by reading the rxd pin level directly in case of a framing error synchronous mode ? serial data communication synchronized with a clock ? serial data communication can be carried out wi th other chips that have a synchronous communication function ? one serial data transfer format data length : 8 bits ? receive error detection : overrun errors detected
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 432 of 1108 rej09b0089-0700 ? full-duplex communication capability ? the transmitter and receiver are mutually independent, enabling transmission and reception to be executed simultaneously ? double-buffering is used in both the transm itter and the receiver, enabling continuous transmission and continuous reception of serial data ? choice of lsb-first or msb-first transfer ? can be selected regardless of the communication mode * (except in the case of asynchronous mode 7-bit data) ? built-in baud rate generator allows any bit rate to be selected ? choice of serial clock source: internal clock from baud rate generator or external clock from sck pin ? four interrupt sources ? four interrupt sources?transmit-data-empty, transmit-end, receive-data-full, and receive error?that can issue requests independently ? the transmit-data-empty and receive-data-full interrupts can activate the data transfer controller (dtc) to execute data transfer ? module stop mode can be set ? as the initial setting, sci operation is halted. register access is enabled by exiting module stop mode note: * descriptions in this section refer to lsb-first transfer.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 433 of 1108 rej09b0089-0700 12.1.2 block diagram figure 12.1 shows a block diagram of the sci. bus interface tdr rsr rdr module data bus tsr scmr ssr scr transmission/ reception control brr baud rate generator internal data bus rxd txd sck parity generation parity check clock external clock /4 /16 /64 txi tei rxi eri smr legend: scmr: smart card mode register rsr: receive shift register rdr: receive data register tsr: transmit shift register tdr: transmit data register smr: serial mode register scr: serial control register ssr: serial status register brr: bit rate register figure 12.1 block diagram of sci
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 434 of 1108 rej09b0089-0700 12.1.3 pin configuration table 12.1 shows the serial pins for each sci channel. table 12.1 sci pins channel pin name symbol i/o function 0 serial clock pin 0 sck0 i/o sci0 clock input/output receive data pin 0 rxd0 input sci0 receive data input transmit data pin 0 txd0 output sci0 transmit data output 1 serial clock pin 1 sck1 i/o sci1 clock input/output receive data pin 1 rxd1 input sci1 receive data input transmit data pin 1 txd1 output sci1 transmit data output
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 435 of 1108 rej09b0089-0700 12.1.4 register configuration the sci has the internal registers shown in table 12.2. these registers are used to specify asynchronous mode or synchronous mode, the data format, and the bit rate, and to control the transmitter/receiver. table 12.2 sci registers channel name abbreviation r/w initial value address * 2 0 serial mode register 0 smr0 r/w h'00 h'ff78 bit rate register 0 brr0 r/w h'ff h'ff79 serial control register 0 scr0 r/w h'00 h'ff7a transmit data register 0 tdr0 r/w h'ff h'ff7b serial status register 0 ssr0 r/(w) * 1 h'84 h'ff7c receive data register 0 rdr0 r h'00 h'ff7d smart card mode register 0 scmr0 r/w h'f2 h'ff7e 1 serial mode register 1 smr1 r/w h'00 h'ff80 bit rate register 1 brr1 r/w h'ff h'ff81 serial control register 1 scr1 r/w h'00 h'ff82 transmit data register 1 tdr1 r/w h'ff h'ff83 serial status register 1 ssr1 r/(w) * 1 h'84 h'ff84 receive data register 1 rdr1 r h'00 h'ff85 smart card mode register 1 scmr1 r/w h'f2 h'ff86 all module stop control register mstpcr r/w h'3fff h'ff3c notes: 1. can only be written with 0 for flag clearing. 2. lower 16 bits of the address.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 436 of 1108 rej09b0089-0700 12.2 register descriptions 12.2.1 receive shift register (rsr) bit : 7 6 5 4 3 2 1 0 r/w : ? ? ? ? ? ? ? ? rsr is a register used to receive serial data. the sci sets serial data input from the rxd pin in rsr in the order received, starting with the lsb (bit 0), and converts it to parallel data. when one byte of data has been received, it is transferred to rdr automatically. rsr cannot be directly read or written to by the cpu. 12.2.2 receive data register (rdr) bit : 7 6 5 4 3 2 1 0 initial value : 0 0 0 0 0 0 0 0 r/w : r r r r r r r r rdr is a register that stores received serial data. when the sci has received one byte of serial data, it transfers the received serial data from rsr to rdr where it is stored, and completes the receive operation. after this, rsr is receive-enabled. since rsr and rdr function as a double buffer in this way, continuous receive operations can be performed. rdr is a read-only register, and cannot be written to by the cpu. rdr is initialized to h'00 by a reset, and in standby mode or module stop mode.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 437 of 1108 rej09b0089-0700 12.2.3 transmit shift register (tsr) bit : 7 6 5 4 3 2 1 0 r/w : ? ? ? ? ? ? ? ? tsr is a register used to transmit serial data. to perform serial data transmission, the sci first transfers transmit data from tdr to tsr, then sends the data to the txd pin starting with the lsb (bit 0). when transmission of one byte is completed, the next transmit data is transferred from tdr to tsr, and transmission started, automatically. ho wever, data transfer from tdr to tsr is not performed if the tdre bit in ssr is set to 1. tsr cannot be directly read or written to by the cpu. 12.2.4 transmit data register (tdr) bit : 7 6 5 4 3 2 1 0 initial value : 1 1 1 1 1 1 1 1 r/w : r/w r/w r/w r/w r/w r/w r/w r/w tdr is an 8-bit register that stores data for serial transmission. when the sci detects that tsr is empty, it transfers the transmit data written in tdr to tsr and starts serial transmission. continuous serial transmission can be carried out by writing the next transmit data to tdr during serial transmission of the data in tsr. tdr can be read or written to by the cpu at all times. tdr is initialized to h'ff by a reset, and in standby mode or module stop mode.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 438 of 1108 rej09b0089-0700 12.2.5 serial mode register (smr) bit : 7 6 5 4 3 2 1 0 c/ a chr pe o/ e stop mp cks1 cks0 initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w smr is an 8-bit register used to set the sci?s se rial transfer format and select the baud rate generator clock source. smr can be read or written to by the cpu at all times. smr is initialized to h'00 by a reset and in hardware standby mode. in software standby mode and module stop mode it retains its previous state. bit 7?communication mode (c/ a ): selects asynchronous mode or synchronous mode as the sci operating mode. bit 7 c/ a description 0 asynchronous mode (initial value) 1 synchronous mode bit 6?character length (chr): selects 7 or 8 bits as the data length in asynchronous mode. in synchronous mode, a fixed data length of 8 bits is used regardless of the chr setting. bit 6 chr description 0 8-bit data (initial value) 1 7-bit data * note: * when 7-bit data is selected, the msb (bit 7) of tdr is not transmitted, and it is not possible to choose between lsb-first or msb-first transfer.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 439 of 1108 rej09b0089-0700 bit 5?parity enable (pe): in asynchronous mode, selects whether or not parity bit addition is performed in transmission, and parity bit checking in reception. in synchronous mode and with a multiprocessor format, parity bit addition and checking is not performed, regardless of the pe bit setting. bit 5 pe description 0 parity bit addition and checking disabled (initial value) 1 parity bit addition and checking enabled * note: * when the pe bit is set to 1, the parity (even or odd) specified by the o/ e bit is added to transmit data before transmission. in reception, the parity bit is checked for the parity (even or odd) specified by the o/ e bit. bit 4?parity mode (o/ e ): selects either even or odd parity for use in parity addition and checking. the o/ e bit setting is only valid when the pe bit is set to 1, enabling parity bit addition and checking, in asynchronous mode. the o/ e bit setting is invalid in synchronous mode, and when parity addition and checking is disabled in asynchronous mode. bit 4 o/ e description 0 even parity * 1 (initial value) 1 odd parity * 2 notes: 1. when even parity is set, parity bit addition is performed in transmission so that the total number of 1 bits in the transmit character plus the parity bit is even. in reception, a check is performed to see if the total number of 1 bits in the receive character plus the parity bit is even. 2. when odd parity is set, parity bit addition is performed in transmission so that the total number of 1 bits in the transmit character plus the parity bit is odd. in reception, a check is performed to see if the total number of 1 bits in the receive character plus the parity bit is odd. bit 3?stop bit length (stop): selects 1 or 2 bits as the stop bit length in asynchronous mode. the stop bits setting is only valid in asynchronous mode. if synchronous mode is set the stop bit setting is invalid since stop bits are not added.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 440 of 1108 rej09b0089-0700 bit 3 stop description 0 1 stop bit: in transmission, a single 1-bit (stop bit) is added to the end of a transmit character before it is sent. (initial value) 1 2 stop bits : in transmission, two 1-bits (stop bits) are added to the end of a transmit character before it is sent. in reception, only the first stop bit is checked, regardless of the stop bit setting. if the second stop bit is 1, it is treated as a stop bit; if it is 0, it is treated as the start bit of the next transmit character. bit 2?multiprocessor mode (mp): selects multiprocessor format. when multiprocessor format is selected, the pe bit and o/ e bit parity settings are invalid. the mp bit setting is only valid in asynchronous mode; it is invalid in synchronous mode. for details of the multiprocessor communication function, see section 12.3.3, multiprocessor communication function. bit 2 mp description 0 multiprocessor function disabled (initial value) 1 multiprocessor format selected bits 1 and 0?clock select 1 and 0 (cks1, cks0): these bits select the clock source for the baud rate generator. the clock source can be selected from , /4, /16, and /64, according to the setting of bits cks1 and cks0. for the relation between the clock source, the bit rate register setting, and the baud rate, see section 12.2.8, bit rate register (brr). bit 1 cks1 bit 0 cks0 description 0 0 clock (initial value) 1 /4 clock 1 0 /16 clock 1 /64 clock
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 441 of 1108 rej09b0089-0700 12.2.6 serial control register (scr) bit : 7 6 5 4 3 2 1 0 tie rie te re mpie teie cke1 cke0 initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w scr is a register that performs enabling or disab ling of sci transfer operations, serial clock output in asynchronous mode, and interrupt requests, and selection of the serial clock source. scr can be read or written to by the cpu at all times. scr is initialized to h'00 by a reset and in hardware standby mode. in software standby mode and module stop mode it retains its previous state. bit 7?transmit interrupt enable (tie): enables or disables transmit-data-empty interrupt (txi) request generation when serial transmit data is transferred from tdr to tsr and the tdre flag in ssr is set to 1. bit 7 tie description 0 transmit-data-empty interrupt (txi) requests disabled * (initial value) 1 transmit-data-empty interrupt (txi) requests enabled note: * txi interrupt request cancellation can be performed by reading 1 from the tdre flag, then clearing it to 0, or by clearing the tie bit to 0.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 442 of 1108 rej09b0089-0700 bit 6?receive interrupt enable (rie): enables or disables recei ve-data-full interrupt (rxi) request and receive-error interrupt (eri) request gene ration when serial receive data is transferred from rsr to rdr and the rdrf flag in ssr is set to 1. bit 6 rie description 0 receive-data-full interrupt (rxi) request and receive-error interrupt (eri) request disabled * (initial value) 1 receive-data-full interrupt (rxi) request and receive-error interrupt (eri) request enabled note: * rxi and eri interrupt request cancellation can be performed by reading 1 from the rdrf flag, or the fer, per, or orer flag, then clearing the flag to 0, or by clearing the rie bit to 0. bit 5?transmit enable (te): enables or disables the start of serial transmission by the sci. bit 5 te description 0 transmission disabled * 1 (initial value) 1 transmission enabled * 2 notes: 1. the tdre flag in ssr is fixed at 1. 2. in this state, serial transmission is started when transmit data is written to tdr and the tdre flag in ssr is cleared to 0. smr setting must be performed to decide the transfer format before setting the te bit to 1. bit 4?receive enable (re): enables or disables the start of serial reception by the sci. bit 4 re description 0 reception disabled * 1 (initial value) 1 reception enabled * 2 notes: 1. clearing the re bit to 0 does not affect the rdrf, fer, per, and orer flags, which retain their states. 2. serial reception is started in this state when a start bit is detected in asynchronous mode or serial clock input is detected in synchronous mode. smr setting must be performed to decide the transfer format before setting the re bit to 1.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 443 of 1108 rej09b0089-0700 bit 3?multiprocessor interrupt enable (mpie): enables or disables multiprocessor interrupts. the mpie bit setting is only valid in asynchronous mode when the mp bit in smr is set to 1. the mpie bit setting is invalid in synchronous mode or when the mp bit is cleared to 0. bit 3 mpie description 0 multiprocessor interrupts disabled (normal reception performed) (initial value) [clearing conditions] ? when the mpie bit is cleared to 0 ? when data with mpb = 1 is received 1 multiprocessor interrupts enabled * receive-data-full interrupt (rxi) requests, receive-error interrupt (eri) requests, and setting of the rdrf, fer, and orer flags in ssr are disabled until data with the multiprocessor bit set to 1 is received. note: * when receive data including mpb = 0 is received, receive data transfer from rsr to rdr, receive error detection, and setting of the rdrf, fer, and orer flags in ssr, is not performed. when receive data including mpb = 1 is received, the mpb bit in ssr is set to 1, the mpie bit is cleared to 0 automatically, and generation of rxi and eri interrupts (when the tie and rie bits in scr are set to 1) and fer and orer flag setting is enabled. bit 2?transmit end interrupt enable (teie): enables or disables transmit-end interrupt (tei) request generation when there is no valid transmit data in tdr in msb data transmission. bit 2 teie description 0 transmit end interrupt (tei) request disabled * (initial value) 1 transmit end interrupt (tei) request enabled * note: * tei cancellation can be performed by reading 1 from the tdre flag in ssr, then clearing it to 0 and clearing the tend flag to 0, or by clearing the teie bit to 0.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 444 of 1108 rej09b0089-0700 bits 1 and 0?clock enable 1 and 0 (cke1, cke0): these bits are used to select the sci clock source and enable or disable clock output from the sck pin. the combination of the cke1 and cke0 bits determines whether the sck pin functions as an i/o port, the serial clock output pin, or the serial clock input pin. the setting of the cke0 bit, however, is only valid for internal clock operation (cke1 = 0) in asynchronous mode. the cke0 bit setting is invalid in synchronous mode, and in the case of external clock operation (cke1 = 1). set cke1 and cke0 before determining the sci operating mode with smr. for details of clock source selection, see table 12.9. bit 1 cke1 bit 0 cke0 description 0 0 asynchronous mode internal clock/sck pin functions as i/o port * 1 synchronous mode internal clock/sck pin functions as serial clock output 1 asynchronous mode internal clock/sck pin functions as clock output * 2 synchronous mode internal clock/sck pin functions as serial clock output 1 0 asynchronous mode external clock/sck pin functions as clock input * 3 synchronous mode external clock/sck pin functions as serial clock input 1 asynchronous mode external clock/sck pin functions as clock input * 3 synchronous mode external clock/sck pin functions as serial clock input notes: 1. initial value 2. outputs a clock of the same frequency as the bit rate. 3. inputs a clock with a frequency 16 times the bit rate.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 445 of 1108 rej09b0089-0700 12.2.7 serial status register (ssr) bit : 7 6 5 4 3 2 1 0 tdre rdrf orer fer per tend mpb mpbt initial value : 1 0 0 0 0 1 0 0 r/w : r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r r r/w note: * only 0 can be written, to clear the flag. ssr is an 8-bit register containing status flags that indicate the operating status of the sci, and multiprocessor bits. ssr can be read or written to by the cpu at all times. however, 1 cannot be written to flags tdre, rdrf, orer, per, and fer. also note that in order to clear these flags they must be read as 1 beforehand. the tend flag and mpb flag are read-only flags and cannot be modified. ssr is initialized to h'84 by a reset, and in standby mode or module stop mode. bit 7?transmit data register empty (tdre): indicates that data has been transferred from tdr to tsr and the next serial data can be written to tdr. bit 7 tdre description 0 [clearing conditions] ? when 0 is written to tdre after reading tdre = 1 ? when the dtc is activated by a txi interrupt and writes data to tdr 1 [setting conditions] (initial value) ? when the te bit in scr is 0 ? when data is transferred from tdr to tsr and data can be written to tdr
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 446 of 1108 rej09b0089-0700 bit 6?receive data register full (rdrf): indicates that the received data is stored in rdr. bit 6 rdrf description 0 [clearing conditions] (initial value) ? when 0 is written to rdrf after reading rdrf = 1 ? when the dtc is activated by an rxi interrupt and reads data from rdr 1 [setting condition] when serial reception ends normally and receive data is transferred from rsr to rdr note: rdr and the rdrf flag are not affected and retain their previous values when an error is detected during reception or when the re bit in scr is cleared to 0. if reception of the next data is completed while the rdrf flag is still set to 1, an overrun error will occur and the receive data will be lost. bit 5?overrun error (orer): indicates that an overrun error occurred during reception, causing abnormal termination. bit 5 orer description 0 [clearing condition] (initial value) * 1 when 0 is written to orer after reading orer = 1 1 [setting condition] when the next serial reception is completed while rdrf = 1 * 2 notes: 1. the orer flag is not affected and retains its previous state when the re bit in scr is cleared to 0. 2. the receive data prior to the overrun error is retained in rdr, and the data received subsequently is lost. also, subsequent serial reception cannot be continued while the orer flag is set to 1. in synchronous mode, serial transmission cannot be continued, either.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 447 of 1108 rej09b0089-0700 bit 4?framing error (fer): indicates that a framing error occurred during reception in asynchronous mode, causing abnormal termination. bit 4 fer description 0 [clearing condition] (initial value) * 1 when 0 is written to fer after reading fer = 1 1 [setting condition] when the sci checks the stop bit at the end of the receive data when reception ends, and the stop bit is 0 * 2 notes: 1. the fer flag is not affected and retains its previous state when the re bit in scr is cleared to 0. 2. in 2-stop-bit mode, only the first stop bit is checked for a value of 0; the second stop bit is not checked. if a framing error occurs, the receive data is transferred to rdr but the rdrf flag is not set. also, subsequent serial reception cannot be continued while the fer flag is set to 1. in synchronous mode, serial transmission cannot be continued, either. bit 3?parity error (per): indicates that a parity error oc curred during reception using parity addition in asynchronous mode, causing abnormal termination. bit 3 per description 0 [clearing condition] (initial value) * 1 when 0 is written to per after reading per = 1 1 [setting condition] when, in reception, the number of 1 bits in the receive data plus the parity bit does not match the parity setting (even or odd) specified by the o/ e bit in smr * 2 notes: 1. the per flag is not affected and retains its previous state when the re bit in scr is cleared to 0. 2. if a parity error occurs, the receive data is transferred to rdr but the rdrf flag is not set. also, subsequent serial reception cannot be continued while the per flag is set to 1. in synchronous mode, serial transmission cannot be continued, either.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 448 of 1108 rej09b0089-0700 bit 2?transmit end (tend): indicates that there is no valid data in tdr when the last bit of the transmit character is sent, and transmission has been ended. the tend flag is read-only and cannot be modified. bit 2 tend description 0 [clearing conditions] ? when 0 is written to tdre after reading tdre = 1 ? when the dtc is activated by a txi interrupt and writes data to tdr 1 [setting conditions] (initial value) ? when the te bit in scr is 0 ? when tdre = 1 at transmission of the last bit of a 1-byte serial transmit character bit 1?multiprocessor bit (mpb): when reception is performed using multiprocessor format in asynchronous mode, mpb stores the multiprocessor bit in the receive data. mpb is a read-only bit, and cannot be modified. bit 1 mpb description 0 [clearing condition] (initial value) * when data with a 0 multiprocessor bit is received 1 [setting condition] when data with a 1 multiprocessor bit is received note: * retains its previous state when the re bit in scr is cleared to 0 with multiprocessor format. bit 0?multiprocessor bit transfer (mpbt): when transmission is performed using multiprocessor format in asynchronous mode, mpbt stores the multiprocessor bit to be added to the transmit data. the mpbt bit setting is invalid when multiprocessor format is not used, when not transmitting, and in synchronous mode. bit 0 mpbt description 0 data with a 0 multiprocessor bit is transmitted (initial value) 1 data with a 1 multiprocessor bit is transmitted
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 449 of 1108 rej09b0089-0700 12.2.8 bit rate register (brr) bit : 7 6 5 4 3 2 1 0 initial value : 1 1 1 1 1 1 1 1 r/w : r/w r/w r/w r/w r/w r/w r/w r/w brr is an 8-bit register that sets the serial tr ansfer bit rate in accordance with the baud rate generator operating clock selected by bits cks1 and cks0 in smr. brr can be read or written to by the cpu at all times. brr is initialized to h'ff by a reset and in hardware standby mode. in software standby mode and module stop mode it retains its previous state. as baud rate generator control is performed independently for each channel, different values can be set for each channel. table 12.3 shows sample brr settings in asynchronous mode, and table 12.4 shows sample brr settings in synchronous mode.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 450 of 1108 rej09b0089-0700 table 12.3 brr settings for various bit rates (asynchronous mode) = 2 mhz = 2.097152 mhz = 2.4576 mhz = 3 mhz bit rate (bits/s) n n error (%) n n error (%) n n error (%) n n error (%) 110 1 141 0.03 1 148 ?0.04 1 174 ?0.26 1 212 0.03 150 1 103 0.16 1 108 0.21 1 127 0.00 1 155 0.16 300 0 207 0.16 0 217 0.21 0 255 0.00 1 77 0.16 600 0 103 0.16 0 108 0.21 0 127 0.00 0 155 0.16 1200 0 51 0.16 0 54 ?0.70 0 63 0.00 0 77 0.16 2400 0 25 0.16 0 26 1.14 0 31 0.00 0 38 0.16 4800 0 12 0.16 0 13 ?2.48 0 15 0.00 0 19 ?2.34 9600 0 6 ? 0 6 ?2.48 0 7 0.00 0 9 ?2.34 19200 0 2 ? 0 2 ? 0 3 0.00 0 4 ?2.34 31250 0 1 0.00 0 1 ? 0 1 ? 0 2 0.00 38400 0 1 ? 0 1 ? 0 1 0.00 ? ? ? = 3.6864 mhz = 4 mhz = 4.9152 mhz = 5 mhz bit rate (bits/s) n n error (%) n n error (%) n n error (%) n n error (%) 110 2 64 0.70 2 70 0.03 2 86 0.31 2 88 ?0.25 150 1 191 0.00 1 207 0.16 1 255 0.00 2 64 0.16 300 1 95 0.00 1 103 0.16 1 127 0.00 1 129 0.16 600 0 191 0.00 0 207 0.16 0 255 0.00 1 64 0.16 1200 0 95 0.00 0 103 0.16 0 127 0.00 0 129 0.16 2400 0 47 0.00 0 51 0.16 0 63 0.00 0 64 0.16 4800 0 23 0.00 0 25 0.16 0 31 0.00 0 32 ?1.36 9600 0 11 0.00 0 12 0.16 0 15 0.00 0 15 1.73 19200 0 5 0.00 0 6 ? 0 7 0.00 0 7 1.73 31250 ? ? ? 0 3 0.00 0 4 ?1.70 0 4 0.00 38400 0 2 0.00 0 2 ? 0 3 0.00 0 3 1.73
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 451 of 1108 rej09b0089-0700 = 6 mhz = 6.144 mhz = 7.3728 mhz = 8 mhz bit rate (bits/s) n n error (%) n n error (%) n n error (%) n n error (%) 110 2 106 ?0.44 2 108 0.08 2 130 ?0.07 2 141 0.03 150 2 77 0.16 2 79 0.00 2 95 0.00 2 103 0.16 300 1 155 0.16 1 159 0.00 1 191 0.00 1 207 0.16 600 1 77 0.16 1 79 0.00 1 95 0.00 1 103 0.16 1200 0 155 0.16 0 159 0.00 0 191 0.00 0 207 0.16 2400 0 77 0.16 0 79 0.00 0 95 0.00 0 103 0.16 4800 0 38 0.16 0 39 0.00 0 47 0.00 0 51 0.16 9600 0 19 ?2.34 0 19 0.00 0 23 0.00 0 25 0.16 19200 0 9 ?2.34 0 9 0.00 0 11 0.00 0 12 0.16 31250 0 5 0.00 0 5 2.40 ? ? ? 0 7 0.00 38400 0 4 ?2.34 0 4 0.00 0 5 0.00 ? ? ? = 9.8304 mhz = 10 mhz = 12 mhz = 12.288 mhz bit rate (bits/s) n n error (%) n n error (%) n n error (%) n n error (%) 110 2 174 ?0.26 2 177 ?0.25 2 212 0.03 2 217 0.08 150 2 127 0.00 2 129 0.16 2 155 0.16 2 159 0.00 300 1 255 0.00 2 64 0.16 2 77 0.16 2 79 0.00 600 1 127 0.00 1 129 0.16 1 155 0.16 1 159 0.00 1200 0 255 0.00 1 64 0.16 1 77 0.16 1 79 0.00 2400 0 127 0.00 0 129 0.16 0 155 0.16 0 159 0.00 4800 0 63 0.00 0 64 0.16 0 77 0.16 0 79 0.00 9600 0 31 0.00 0 32 ?1.36 0 38 0.16 0 39 0.00 19200 0 15 0.00 0 15 1.73 0 19 ?2.34 0 19 0.00 31250 0 9 ?1.70 0 9 0.00 0 11 0.00 0 11 2.40 38400 0 7 0.00 0 7 1.73 0 9 ?2.34 0 9 0.00
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 452 of 1108 rej09b0089-0700 = 14 mhz = 14.7456 mhz = 16 mhz = 17.2032 mhz bit rate (bits/s) n n error (%) n n error (%) n n error (%) n n error (%) 110 2 248 ?0.17 3 64 0.70 3 70 0.03 3 75 0.48 150 2 181 0.16 2 191 0.00 2 207 0.16 2 223 0.00 300 2 90 0.16 2 95 0.00 2 103 0.16 2 111 0.00 600 1 181 0.16 1 191 0.00 1 207 0.16 1 223 0.00 1200 1 90 0.16 1 95 0.00 1 103 0.16 1 111 0.00 2400 0 181 0.16 0 191 0.00 0 207 0.16 0 223 0.00 4800 0 90 0.16 0 95 0.00 0 103 0.16 0 111 0.00 9600 0 45 ?0.93 0 47 0.00 0 51 0.16 0 55 0.00 19200 0 22 ?0.93 0 23 0.00 0 25 0.16 0 27 0.00 31250 0 13 0.00 0 14 ?1.70 0 15 0.00 0 16 1.20 38400 0 10 ? 0 11 0.00 0 12 0.16 0 13 0.00 = 18 mhz = 19.6608 mhz = 20 mhz = 25 mhz bit rate (bits/s) n n error (%) n n error (%) n n error (%) n n error (%) 110 3 79 ?0.12 3 86 0.31 3 88 ?0.25 3 110 ?0.02 150 2 233 0.16 2 255 0.00 3 64 0.16 3 80 0.47 300 2 116 0.16 2 127 0.00 2 129 0.16 2 162 ?0.15 600 1 233 0.16 1 255 0.00 2 64 0.16 2 80 0.47 1200 1 116 0.16 1 127 0.00 1 129 0.16 1 162 ?0.15 2400 0 233 0.16 0 255 0.00 1 64 0.16 1 80 0.47 4800 0 116 0.16 0 127 0.00 0 129 0.16 0 162 ?0.15 9600 0 58 ?0.69 0 63 0.00 0 64 0.16 0 80 0.47 19200 0 28 1.02 0 31 0.00 0 32 ?1.36 0 40 ?0.76 31250 0 17 0.00 0 19 ?1.70 0 19 0.00 0 24 0.00 38400 0 14 ?2.34 0 15 0.00 0 15 1.73 0 19 1.73
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 453 of 1108 rej09b0089-0700 table 12.4 brr settings for various bit rates (synchronous mode) = 2 mhz = 4 mhz = 8 mhz = 10 mhz = 16 mhz = 20 mhz = 25 mhz bit rate (bits/s) n n n n n n n n n n n n n n 110 3 70 250 2 124 2 249 3 124 ? ? 3 249 500 1 249 2 124 2 249 ? ? 3 124 ? ? 1 k 1 124 1 249 2 124 ? ? 2 249 ? ? 3 97 2.5 k 0 199 1 99 1 199 1 249 2 99 2 124 2 155 5 k 0 99 0 199 1 99 1 124 1 199 1 249 2 77 10 k 0 49 0 99 0 199 0 249 1 99 1 124 1 155 25 k 0 19 0 39 0 79 0 99 0 159 0 199 0 249 50 k 0 9 0 19 0 39 0 49 0 79 0 99 0 124 100 k 0 4 0 9 0 19 0 24 0 39 0 49 0 62 250 k 0 1 0 3 0 7 0 9 0 15 0 19 0 24 500 k 0 0 * 0 1 0 3 0 4 0 7 0 9 ? ? 1 m 0 0 * 0 1 0 3 0 4 ? ? 2.5 m 0 0 * 0 1 ? ? 5 m 0 0 * ? ? legend: blank : cannot be set. ? : can be set, but there will be a degree of error. * : continuous transfer is not possible. note: as far as possible, the setting should be made so that the error is no more than 1%.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 454 of 1108 rej09b0089-0700 the brr setting is found from the following formulas. asynchronous mode: n = 64 2 2n?1 b 10 6 ? 1 synchronous mode: n = 8 2 2n?1 b 10 6 ? 1 where b: bit rate (bits/s) n: brr setting for baud rate generator (0 n 255) : operating frequency (mhz) n: baud rate generator input clock (n = 0 to 3) (see the table below for the relation between n and the clock.) smr setting n clock cks1 cks0 0 0 0 1 /4 0 1 2 /16 1 0 3 /64 1 1 the bit rate error in asynchronous mode is found from the following formula: error (%) = { 10 6 (n + 1) b 64 2 2n?1 ? 1 } 100
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 455 of 1108 rej09b0089-0700 table 12.5 shows the maximum bit rate for each frequency in asynchronous mode. tables 12.6 and 12.7 show the maximum bit rates with external clock input. table 12.5 maximum bit rate for each frequency (asynchronous mode) (mhz) maximum bit rate (bits/s) n n 2 62500 0 0 2.097152 65536 0 0 2.4576 76800 0 0 3 93750 0 0 3.6864 115200 0 0 4 125000 0 0 4.9152 153600 0 0 5 156250 0 0 6 187500 0 0 6.144 192000 0 0 7.3728 230400 0 0 8 250000 0 0 9.8304 307200 0 0 10 312500 0 0 12 375000 0 0 12.288 384000 0 0 14 437500 0 0 14.7456 460800 0 0 16 500000 0 0 17.2032 537600 0 0 18 562500 0 0 19.6608 614400 0 0 20 625000 0 0 25 781250 0 0
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 456 of 1108 rej09b0089-0700 table 12.6 maximum bit rate with ext ernal clock input (asynchronous mode) (mhz) external input clock (m hz) maximum bit rate (bits/s) 2 0.5000 31250 2.097152 0.5243 32768 2.4576 0.6144 38400 3 0.7500 46875 3.6864 0.9216 57600 4 1.0000 62500 4.9152 1.2288 76800 5 1.2500 78125 6 1.5000 93750 6.144 1.5360 96000 7.3728 1.8432 115200 8 2.0000 125000 9.8304 2.4576 153600 10 2.5000 156250 12 3.0000 187500 12.288 3.0720 192000 14 3.5000 218750 14.7456 3.6864 230400 16 4.0000 250000 17.2032 4.3008 268800 18 4.5000 281250 19.6608 4.9152 307200 20 5.0000 312500 25 6.2500 390625
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 457 of 1108 rej09b0089-0700 table 12.7 maximum bit rate with external clock input (synchronous mode) (mhz) external input clock (m hz) maximum bit rate (bits/s) 2 0.3333 333333.3 4 0.6667 666666.7 6 1.0000 1000000.0 8 1.3333 1333333.3 10 1.6667 1666666.7 12 2.0000 2000000.0 14 2.3333 2333333.3 16 2.6667 2666666.7 18 3.0000 3000000.0 20 3.3333 3333333.3 25 4.1667 4166666.7 12.2.9 smart card mode register (scmr) bit : 7 6 5 4 3 2 1 0 ? ? ? ? sdir sinv ? smif initial value : 1 1 1 1 0 0 1 0 r/w : ? ? ? ? r/w r/w ? r/w scmr selects lsb-first or msb-first transfer by means of bit sdir. except in the case of asynchronous mode 7-bit data, lsb-first or msb-first transfer can be selected regardless of the serial communication mode. the descriptions in this chapter refer to lsb-first transfer. for details of the other bits in scmr, see section 13.2.1, smart card mode register (scmr). scmr is initialized to h'f2 by a reset and in hardware standby mode. in software standby mode and module stop mode it retains its previous state. bits 7 to 4?reserved: these bits cannot be modified and are always read as 1.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 458 of 1108 rej09b0089-0700 bit 3?smart card data transfer direction (sdir): selects the serial/parallel conversion format. this bit is valid when 8-bit data is used as the transmit/receive format. bit 3 sdir description 0 tdr contents are transmitted lsb-first (initial value) receive data is stored in rdr lsb-first 1 tdr contents are transmitted msb-first receive data is stored in rdr msb-first bit 2?smart card data invert (sinv): specifies inversion of the data logic level. the sinv bit does not affect the logic level of the parity bit(s): parity bit inversion requires inversion of the o/ e bit in smr. bit 2 sinv description 0 tdr contents are transmitted without modification (initial value) receive data is stored in rdr without modification 1 tdr contents are inverted before being transmitted receive data is stored in rdr in inverted form bit 1?reserved: this bit cannot be modified and is always read as 1. bit 0?smart card interface mode select (smif): when the smart card interface operates as a normal sci, 0 should be written to this bit. bit 0 smif description 0 operates as normal sci (smart card interface function disabled) (initial value) 1 smart card interface function enabled
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 459 of 1108 rej09b0089-0700 12.2.10 module stop control register (mstpcr) mstpcrh mstpcrl bit : 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value : 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w : r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w mstpcr is a 16-bit readable/writable register that performs module stop mode control. when the corresponding bit of bits mstp6 to mstp5 is set to 1, sci operation stops at the end of the bus cycle and a transition is made to module stop mode. registers cannot be read or written to in module stop mode. for details, see section 19.5, module stop mode. mstpcr is initialized to h'3fff by a reset and in ha rdware standby mode. it is not initialized in software standby mode. bit 6?module stop (mstp6): specifies the sci channel 1 module stop mode. bit 6 mstp6 description 0 sci channel 1 module stop mode cleared 1 sci channel 1 module stop mode set (initial value) bit 5?module stop (mstp5): specifies the sci channel 0 module stop mode. bit 5 mstp5 description 0 sci channel 0 module stop mode cleared 1 sci channel 0 module stop mode set (initial value)
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 460 of 1108 rej09b0089-0700 12.3 operation 12.3.1 overview the sci can carry out serial communication in two modes: asynchronous mode in which synchronization is achieved character by character, and synchronous mode in which synchronization is achieved with clock pulses. selection of asynchronous or synchronous mode and the transmission format is made using smr as shown in table 12.8. the sci clock is determined by a combination of the c/ a bit in smr and the cke1 and cke0 bits in scr, as shown in table 12.9. asynchronous mode ? data length: choice of 7 or 8 bits ? choice of parity addition, multiprocessor bit addition, and addition of 1 or 2 stop bits (the combination of these parameters determines the transfer format and character length) ? detection of framing, parity, and overrun errors, and breaks, during reception ? choice of internal or external clock as sci clock source ? when internal clock is selected: the sci operates on the baud rate generator clock and a clock with the same frequency as the bit rate can be output ? when external clock is selected: a clock with a frequency of 16 times the bit rate must be input (the built-in baud rate generator is not used) synchronous mode ? transfer format: fixed 8-bit data ? detection of overrun errors during reception ? choice of internal or external clock as sci clock source ? when internal clock is selected: the sci operates on the baud rate generator clock and a serial clock is output off-chip ? when external clock is selected: the built-in baud rate generator is not used, and the sci operates on the input serial clock
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 461 of 1108 rej09b0089-0700 table 12.8 smr settings and serial transfer format selection smr settings sci transfer format bit 7 bit 6 bit 2 bit 5 bit 3 c/ a chr mp pe stop mode data length multi- processor bit parity bit stop bit length 0 0 0 0 0 8-bit data no no 1 bit 1 asynchronous mode 2 bits 1 0 yes 1 bit 1 2 bits 1 0 0 7-bit data no 1 bit 1 2 bits 1 0 yes 1 bit 1 2 bits 0 1 ? 0 8-bit data yes no 1 bit ? 1 2 bits 1 ? 0 7-bit data 1 bit ? 1 asynchronous mode (multi- processor format) 2 bits 1 ? ? ? ? synchronous mode 8-bit data no none table 12.9 smr and scr settings and sci clock source selection smr scr settings sci transmit/receive clock bit 7 bit 1 bit 0 c/ a cke1 cke0 mode clock source sck pin function 0 0 0 internal sci does not use sck pin 1 asynchronous mode outputs clock with same frequency as bit rate 1 0 external 1 inputs clock with frequency of 16 times the bit rate 1 0 0 internal outputs serial clock 1 1 0 synchronous mode external inputs serial clock 1
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 462 of 1108 rej09b0089-0700 12.3.2 operation in asynchronous mode in asynchronous mode, characters are sent or received, each preceded by a start bit indicating the start of communication and one or two stop bits indicating the end of communication. serial communication is thus carried out with synchron ization established on a character-by-character basis. inside the sci, the transmitter and receiver are independent units, enabling full-duplex communication. both the transmitter and the receiver also have a double-buffered structure, so that data can be read or written during transmission or reception, enabling continuous data transfer. figure 12.2 shows the general format for asynchronous serial communication. in asynchronous serial communication, the communication line is usually held in the mark state (high level). the sci monitors the communication line, and when it goes to the space state (low level), recognizes a start bit a nd starts serial communication. one serial communication character consists of a start bit (low level), followed by data (in lsb- first order), a parity bit (high or low level), and finally one or two stop bits (high level). in asynchronous mode, the sci performs synchronization at the falling edge of the start bit in reception. the sci samples the data on the 8th pulse of a clock with a frequency of 16 times the length of one bit, so that the transfer data is latched at the center of each bit. lsb start bit msb idle state (mark state) stop bit(s) 0 transmit/receive data d0 d1 d2 d3 d4 d5 d6 d7 0/1 1 1 1 1 serial data parity bit 1 bit 1 or 2 bits 7 or 8 bits 1 bit, or none one unit of transfer data (character or frame) figure 12.2 data format in asynchronous communication (example with 8-bit data, parity, two stop bits)
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 463 of 1108 rej09b0089-0700 data transfer format table 12.10 shows the data transfer formats that can be used in asynchronous mode. any of 12 transfer formats can be selected according to the smr setting. table 12.10 serial transfer formats (asynchronous mode) p e 0 0 1 1 0 0 1 1 s 8 - b i t data s t op s 7 - b i t data s t op s 8 - b i t data s t op s t op s 8 - b i t data p s t op s 7 - b i t data s t op p s 8 - b i t data mpb s t op s 8 - b i t data mpb s t op s t op s 7 - b i t data s t op mpb s 7 - b i t data s t op mpb s t op s 7 - b i t data s t op s t op chr 0 0 0 0 1 1 1 1 0 0 1 1 mp 0 0 0 0 0 0 0 0 1 1 1 1 s t op 0 1 0 1 0 1 0 1 0 1 0 1 sm r sett i n g s 123 4 5678 9 10 11 12 ser i a l t ransfer f ormat and f rame l en g th s t op s 8 - b i t data p s t op s 7 - b i t data s t op p s t op legend: s: start bit stop: stop bit p: parity bit mpb: multiprocessor bit
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 464 of 1108 rej09b0089-0700 clock either an internal clock generated by the built-in ba ud rate generator or an external clock input at the sck pin can be selected as the sci?s serial clock, according to the setting of the c/ a bit in smr and the cke1 and cke0 bits in scr. for details of sci clock source selection, see table 12.9. when an external clock is input at the sck pin, the clock frequency should be 16 times the bit rate used. when the sci is operated on an internal clock, the clock can be output from the sck pin. the frequency of the clock output in this case is equa l to the bit rate, and the phase is such that the rising edge of the clock is at the center of each transmit data bit, as shown in figure 12.3. 0 1 frame d0 d1 d2 d3 d4 d5 d6 d7 0/1 1 1 figure 12.3 relation between output clock and transfer data phase (asynchronous mode) data transfer operations sci initialization (asynchronous mode): before transmitting or receiving data, first clear the te and re bits in scr to 0, then initialize the sci as described below. when the operating mode, transfer format, etc., is changed, the te and re bits must be cleared to 0 before making the change using the following procedure. when the te bit is cleared to 0, the tdre flag is set to 1 and tsr is initialized. note that clearing the re bit to 0 does not change the contents of the rdrf, per, fer, and orer flags, or the contents of rdr. when an external clock is used the clock should not be stopped during operation, including initialization, since operation will be unreliable in this case.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 465 of 1108 rej09b0089-0700 figure 12.4 shows a sample sci initialization flowchart. w a i t start of i n i t i a liz at i on set data transfer format i n sm r and s c m r [ 1 ] set cke 1 and cke 0 b i ts i n s cr ( te , re b i ts 0) n o y es set va l ue i n b rr cl ear te and re b i ts i n s cr to 0 [ 2 ] [ 3 ] set te or re b i t i n s cr to 1, and set rie , tie , teie , and mp ie b i ts as necessary [4] 1 - b i t i nterva l e l apsed ? [ 1 ] set the c l ock se l ect i on i n s cr. be sure to c l ear b i ts rie , tie , teie , and mp ie , and b i ts te and re , to 0 . w hen the c l ock i s se l ected i n asynchronous mode, i t i s output i mmed i ate l y after s cr sett i n g s are made . [ 2 ] set the data transfer format i n sm r and s c m r. [ 3 ] w r i te a va l ue correspond i n g to the b i t rate to b rr ( n ot necessary i f an e x terna l c l ock i s used) . [4] w a i t at l east one b i t i nterva l , then set the te b i t or re b i t i n s cr to 1 . al so set the rie , tie , teie , and mp ie b i ts as necessary . sett i n g the te or re b i t enab l es the tx d or rx d p i n to be used . figure 12.4 sample sci initialization flowchart
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 466 of 1108 rej09b0089-0700 serial data transmission (asynchronous mode): figure 12.5 shows a sample flowchart for serial transmission. the following procedure should be used for serial data transmission. n o [ 1 ] y es i n i t i a liz at i on start of transm i ss i on r ead t d re f l a g i n ss r[ 2 ] w r i te transm i t data to t d r and c l ear t d re f l a g i n ss r to 0 n o y es n o y es r ead ten d f l a g i n ss r [ 3 ] n o y es [4] cl ear d r to 0 and set dd r to 1 cl ear te b i t i n s cr to 0 t d re = 1 ? all data transm i tted ? ten d = 1 ? break output ? [ 1 ] s ci i n i t i a liz at i on : t he tx d p i n i s automat i ca ll y des ig nated as the transm i t data output p i n . a fter the te b i t i s set to 1, a frame of 1s i s output, and transm i ss i on i s enab l ed . [ 2 ] s ci status check and transm i t data w r i te : r ead ss r and check that the t d re f l a g i s set to 1, then w r i te transm i t data to t d r and c l ear the t d re f l a g to 0 . [ 3 ] ser i a l transm i ss i on cont i nuat i on procedure : t o cont i nue ser i a l transm i ss i on, read 1 from the t d re f l a g to conf i rm that w r i t i n g i s poss i b l e, then w r i te data to t d r , and then c l ear the t d re f l a g to 0 . c heck i n g and c l ear i n g of the t d re f l a g i s automat i c w hen the d tc i s act i vated by a transm i t - data - empty i nterrupt ( txi ) re q uest, and data i s w r i tten to t d r. [4] break output at the end of ser i a l transm i ss i on : t o output a break i n ser i a l transm i ss i on, set dd r for the port correspond i n g to the tx d p i n to 1, c l ear d r to 0, then c l ear the te b i t i n s cr to 0 . figure 12.5 sample serial transmission flowchart
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 467 of 1108 rej09b0089-0700 in serial transmission, the sci operates as described below. [1] the sci monitors the tdre flag in ssr, and if is 0, recognizes that data has been written to tdr, and transfers the data from tdr to tsr. [2] after transferring data from tdr to tsr, the sci sets the tdre flag to 1 and starts transmission. if the tie bit is set to 1 at this time, a transmit-data-empty interrupt (txi) is generated. the serial transmit data is sent from the txd pin in the following order. [a] start bit: one 0-bit is output. [b] transmit data: 8-bit or 7-bit data is output in lsb-first order. [c] parity bit or multiprocessor bit: one parity bit (even or odd parity), or one multiprocessor bit is output. a format in which neither a parity bit nor a multiprocessor bit is output can also be selected. [d] stop bit(s): one or two 1-bits (stop bits) are output. [e] mark state: 1 is output continuously until the start bit that starts the next transmission is sent. [3] the sci checks the tdre flag at the timing for sending the stop bit. if the tdre flag is cleared to 0, the data is transferred from tdr to tsr, the stop bit is sent, and then serial transmission of the next frame is started. if the tdre flag is set to 1, the tend flag in ssr is set to 1, the stop bit is sent, and then the mark state is entered in which 1 is output continuously. if the teie bit in scr is set to 1 at this time, a tei interrupt request is generated.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 468 of 1108 rej09b0089-0700 figure 12.6 shows an example of the operation for transmission in asynchronous mode. t d re ten d 0 1 frame d0 d1 d7 0 / 11 0d0d1 d7 0 / 1 1 1 1 data start b i t par i ty b i t stop b i t start b i t data par i ty b i t stop b i t txi i nterrupt re q uest g enerated data w r i tten to t d r and t d re f l a g c l eared to 0 i n txi i nterrupt hand li n g rout i ne tei i nterrupt re q uest g enerated i d l e state (mark state) txi i nterrupt re q uest g enerated figure 12.6 example of transmit operation in asynchronous mode (example with 8-bit data, parity, one stop bit)
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 469 of 1108 rej09b0089-0700 serial data reception (asynchronous mode): figure 12.7 shows a sample flowchart for serial reception. the following procedure should be used for serial data reception. y es [ 1 ] n o i n i t i a liz at i on start of recept i on [ 2 ] n o y es r ead r d rf f l a g i n ss r [4] [ 5 ] cl ear re b i t i n s cr to 0 r ead o rer , p er , and fer f l a g s i n ss r e rror hand li n g ( c ont i nued on ne x t pa g e) [ 3 ] r ead rece i ve data i n r d r , and c l ear r d rf f l a g i n ss r to 0 n o y es p er fer o rer = 1 ? r d rf = 1 ? all data rece i ved ? s ci i n i t i a liz at i on : t he rx d p i n i s automat i ca ll y des ig nated as the rece i ve data i nput p i n . r ece i ve error hand li n g and break detect i on : i f a rece i ve error occurs, read the o rer , p er , and fer f l a g s i n ss r to i dent i fy the error . a fter perform i n g the appropr i ate error process i n g , ensure that the o rer , p er , and fer f l a g s are a ll c l eared to 0 . r ecept i on cannot be resumed i f any of these f l a g s are set to 1 . i n the case of a fram i n g error, a break can be detected by read i n g the va l ue of the i nput port correspond i n g to the rx d p i n . s ci status check and rece i ve data read : r ead ss r and check that r d rf = 1, then read the rece i ve data i n r d r and c l ear the r d rf f l a g to 0 . t rans i t i on of the r d rf f l a g from 0 to 1 can a l so be i dent i f i ed by an rxi i nterrupt . ser i a l recept i on cont i nuat i on procedure : t o cont i nue ser i a l recept i on, before the stop b i t for the current frame i s rece i ved, read the r d rf f l a g , read r d r , and c l ear the r d rf f l a g to 0 . t he r d rf f l a g i s c l eared automat i ca ll y w hen the d tc i s act i vated by an rxi i nterrupt and the r d r va l ue i s read . [ 1 ] [ 2 ] [ 3 ] [4] [ 5 ] figure 12.7 sample seri al reception flowchart
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 470 of 1108 rej09b0089-0700 [ 3 ] e rror hand li n g par i ty error hand li n g n o y es cl ear o rer , p er , and fer f l a g s i n ss r to 0 n o y es n o y es f ram i n g error hand li n g n o y es overrun error hand li n g o rer = 1 ? fer = 1 ? break ? p er = 1 ? cl ear re b i t i n s cr to 0 figure 12.7 sample serial reception fl owchart (cont)
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 471 of 1108 rej09b0089-0700 in serial reception, the sci operates as described below. [1] the sci monitors the communication line, and if a 0 stop bit is detected, performs internal synchronization and starts reception. [2] the received data is stored in rsr in lsb-to-msb order. [3] the parity bit and stop bit are received. after receiving these bits, the sci carries out the following checks. [a] parity check: the sci checks whether the number of 1 bits in the receive data agrees with the parity (even or odd) set in the o/ e bit in smr. [b] stop bit check: the sci checks whether the stop bit is 1. if there are two stop bits, only the first is checked. [c] status check: the sci checks whether the rdrf flag is 0, indicating that the receive data can be transferred from rsr to rdr. if all the above checks are passed, the rdrf flag is set to 1, and the receive data is stored in rdr. if a receive error * is detected in the error check, the operation is as shown in table 12.11. note: * subsequent receive operations cannot be performed when a receive error has occurred. also note that the rdrf flag is not set to 1 in reception, and so the error flags must be cleared to 0. [4] if the rie bit in scr is set to 1 when the rd rf flag changes to 1, a receive-data-full interrupt (rxi) request is generated. also, if the rie bit in scr is set to 1 when the orer, per, or fer flag changes to 1, a receive-error interrupt (eri) request is generated.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 472 of 1108 rej09b0089-0700 table 12.11 receive error conditions receive error abbreviation condition data transfer overrun error orer when the next data reception is completed while the rdrf flag in ssr is set to 1 receive data is not transferred from rsr to rdr framing error fer when the stop bit is 0 receive data is transferred from rsr to rdr parity error per when the received data differs from the parity (even or odd) set in smr receive data is transferred from rsr to rdr figure 12.8 shows an example of the operation for reception in asynchronous mode. r d rf fer 0 1 frame d0 d1 d7 0 / 11 0d0d1 d7 0 / 1 0 1 1 data start b i t par i ty b i t stop b i t start b i t data par i ty b i t stop b i t rxi i nterrupt re q uest g enerated eri i nterrupt re q uest g enerated by fram i n g error i d l e state (mark state) r d r data read and r d rf f l a g c l eared to 0 i n rxi i nterrupt hand li n g rout i ne figure 12.8 example of sci receive operation (example with 8-bit data, parity, one stop bit)
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 473 of 1108 rej09b0089-0700 12.3.3 multiprocessor communication function the multiprocessor communication function performs serial communication using the multiprocessor format, in which a multiprocessor bit is added to the transfer data, in asynchronous mode. use of this function enables data transfer to be performed among a number of processors sharing a single serial communication line. when multiprocessor communication is carried ou t, each receiving station is addressed by a unique id code. the serial communication cycle consists of two component cycles: an id transmission cycle which specifies the receiving station, and a data transmission cycle. the multiprocessor bit is used to differentiate between the id transmission cycle and the data transmission cycle. the transmitting station first sends the id of the receiving station with which it wants to perform serial communication as data with a 1 multiprocessor bit added. it then sends transmit data as data with a 0 multiprocessor bit added. the receiving station skips the data until data with a 1 multiprocessor bit is sent. when data with a 1 multiprocessor bit is received, the receiving station compares that data with its own id. the station whose id matches then receives the data sent next. stations whose id does not match continue to skip the data until data with a 1 multiprocessor bit is again received. in this way, data communication is carried out among a number of processors. figure 12.9 shows an example of inter-processor communication using the multiprocessor format. data transfer formats there are four data transfer formats. when the multiprocessor format is specified, the parity bit specification is invalid. for details, see table 12.10.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 474 of 1108 rej09b0089-0700 clock see the section on asynchronous mode. transmitting station receiving station a (id = 01) receiving station b (id = 02) receiving station c (id = 03) receiving station d (id = 04) serial communication line serial data id transmission cycle = receiving station specification data transmission cycle = data transmission to receiving station specified by id (mpb= 1) (mpb= 0) h'01 h'aa legend: mpb: multiprocessor bit figure 12.9 example of inter-processor communication using multiprocessor format (transmission of data h'aa to receiving station a) data transfer operations multiprocessor serial data transmission: figure 12.10 shows a sample flowchart for multiprocessor serial data transmission. the following procedure should be used for multiprocessor serial data transmission.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 475 of 1108 rej09b0089-0700 n o [ 1 ] y es i n i t i a liz at i on start of transm i ss i on r ead t d re f l a g i n ss r[ 2 ] w r i te transm i t data to t d r and set mpb t b i t i n ss r n o y es n o y es r ead ten d f l a g i n ss r [ 3 ] n o y es [4] cl ear d r to 0 and set dd r to 1 cl ear te b i t i n s cr to 0 t d re = 1 ? all data transm i tted ? ten d = 1 ? break output ? cl ear t d re f l a g to 0 s ci i n i t i a liz at i on : t he tx d p i n i s automat i ca ll y des ig nated as the transm i t data output p i n . a fter the te b i t i s set to 1, a frame of 1s i s output, and transm i ss i on i s enab l ed . s ci status check and transm i t data w r i te : r ead ss r and check that the t d re f l a g i s set to 1, then w r i te transm i t data to t d r. set the mpb t b i t i n ss r to 0 or 1 . fi na ll y, c l ear the t d re f l a g to 0 . ser i a l transm i ss i on cont i nuat i on procedure : t o cont i nue ser i a l transm i ss i on, be sure to read 1 from the t d re f l a g to conf i rm that w r i t i n g i s poss i b l e, then w r i te data to t d r , and then c l ear the t d re f l a g to 0 . c heck i n g and c l ear i n g of the t d re f l a g i s automat i c w hen the d tc i s act i vated by a transm i t - data - empty i nterrupt ( txi ) re q uest, and data i s w r i tten to t d r. break output at the end of ser i a l transm i ss i on : t o output a break i n ser i a l transm i ss i on, set the port dd r to 1, c l ear d r to 0, then c l ear the te b i t i n s cr to 0 . [ 1 ] [ 2 ] [ 3 ] [4] figure 12.10 sample multiprocessor serial transmission flowchart
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 476 of 1108 rej09b0089-0700 in serial transmission, the sci operates as described below. [1] the sci monitors the tdre flag in ssr, and if is 0, recognizes that data has been written to tdr, and transfers the data from tdr to tsr. [2] after transferring data from tdr to tsr, the sci sets the tdre flag to 1 and starts transmission. if the tie bit is set to 1 at this time, a transmit-data-empty interrupt (txi) is generated. the serial transmit data is sent from the txd pin in the following order. [a] start bit: one 0-bit is output. [b] transmit data: 8-bit or 7-bit data is output in lsb-first order. [c] multiprocessor bit one multiprocessor bit (mpbt value) is output. [d] stop bit(s): one or two 1-bits (stop bits) are output. [e] mark state: 1 is output continuously until the start bit that starts the next transmission is sent. [3] the sci checks the tdre flag at the timing for sending the stop bit. if the tdre flag is cleared to 0, data is transferred from tdr to tsr, the stop bit is sent, and then serial transmission of the next frame is started. if the tdre flag is set to 1, the tend flag in ssr is set to 1, the stop bit is sent, and then the mark state is entered in which 1 is output continuously. if the teie bit in scr is set to 1 at this time, a transmit-end interrupt (tei) request is generated.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 477 of 1108 rej09b0089-0700 figure 12.11 shows an example of sci operation for transmission using the multiprocessor format. t d re ten d 0 1 frame d0 d1 d7 0 / 11 0d0d1 d7 0 / 1 1 1 1 data start b i t mu l t i- proces - sor b i t stop b i t start b i t data mu l t i- proces - sor b i t stop b i t txi i nterrupt re q uest g enerated data w r i tten to t d r and t d re f l a g c l eared to 0 i n txi i nterrupt hand li n g rout i ne tei i nterrupt re q uest g enerated i d l e state (mark state) txi i nterrupt re q uest g enerated figure 12.11 example of sci transmit operation (example with 8-bit data, multiprocessor bit, one stop bit) multiprocessor serial data reception: figure 12.12 shows a sample flowchart for multiprocessor serial reception. the following procedure should be used fo r multiprocessor serial data reception.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 478 of 1108 rej09b0089-0700 y es [ 1 ] n o i n i t i a liz at i on start of recept i on n o y es [4] cl ear re b i t i n s cr to 0 e rror hand li n g ( c ont i nued on ne x t pa g e) [ 5 ] n o y es fer o rer = 1 ? r d rf = 1 ? all data rece i ved ? r ead mp ie b i t i n s cr [ 2 ] r ead o rer and fer f l a g s i n ss r r ead r d rf f l a g i n ss r[ 3 ] r ead rece i ve data i n r d r n o y es t h i s stat i on ' s i d ? r ead o rer and fer f l a g s i n ss r y es n o r ead r d rf f l a g i n ss r n o y es fer o rer = 1 ? r ead rece i ve data i n r d r r d rf = 1 ? s ci i n i t i a liz at i on : t he rx d p i n i s automat i ca ll y des ig nated as the rece i ve data i nput p i n . i d recept i on cyc l e : set the mp ie b i t i n s cr to 1 . s ci status check, i d recept i on and compar i son : r ead ss r and check that the r d rf f l a g i s set to 1, then read the rece i ve data i n r d r and compare i t wi th th i s stat i on ' s i d . i f the data i s not th i s stat i on ? s i d, set the mp ie b i t to 1 a g a i n, and c l ear the r d rf f l a g to 0 . i f the data i s th i s stat i on ' s i d, c l ear the r d rf f l a g to 0 . s ci status check and data recept i on : r ead ss r and check that the r d rf f l a g i s set to 1, then read the data i n r d r. r ece i ve error hand li n g and break detect i on : i f a rece i ve error occurs, read the o rer and fer f l a g s i n ss r to i dent i fy the error . a fter perform i n g the appropr i ate error hand li n g , ensure that the o rer and fer f l a g s are both c l eared to 0 . r ecept i on cannot be resumed i f e i ther of these f l a g s i s set to 1 . i n the case of a fram i n g error, a break can be detected by read i n g the rx d p i n va l ue . [ 1 ] [ 2 ] [ 3 ] [4] [ 5 ] figure 12.12 sample multiproce ssor serial recepti on flowchart
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 479 of 1108 rej09b0089-0700 e rror hand li n g y es n o cl ear o rer , p er , and fer f l a g s i n ss r to 0 n o y es n o y es f ram i n g error hand li n g overrun error hand li n g o rer = 1 ? fer = 1 ? break ? cl ear re b i t i n s cr to 0 [ 5 ] figure 12.12 sample multiprocesso r serial reception flowchart (cont)
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 480 of 1108 rej09b0089-0700 figure 12.13 shows an example of sci operation for multiprocessor format reception. mpie r d r value 0d0d1 d71 1 0d0d1 d7 01 1 1 data (id1) start bit mpb stop bit start bit data (data1) mpb stop bit rx i interrupt re q uest (multiprocessor interrupt) g enerated mpie = 0 idle state (mark state) r d r f r d r data read and r d r f fla g cleared to 0 in rx i interrupt handlin g routine if not this station's id, mpie bit is set to 1 a g ain rx i interrupt re q uest is not g enerated, and r d r retains its state id1 (a) data does not match station's id mpie r d r value 0d0d1 d71 1 0d0d1 d7 01 1 1 data (id2) start bit mpb stop bit start bit data (data2) mpb stop bit rx i interrupt re q uest (multiprocessor interrupt) g enerated mpie = 0 idle state (mark state) r d r f r d r data read and r d r f fla g cleared to 0 in rx i interrupt handlin g routine matches this station's id, so reception continues, and data is received in rx i interrupt handlin g routine mpie bit set to 1 a g ain id2 (b) data matches station's id data2 id1 figure 12.13 example of sci receive operation (example with 8-bit data, multiprocessor bit, one stop bit)
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 481 of 1108 rej09b0089-0700 12.3.4 operation in synchronous mode in synchronous mode, data is transmitted or received in synchronization with clock pulses, making it suitable for high-speed serial communication. inside the sci, the transmitter and receiver are independent units, enabling full-duplex communication by use of a common clock. both the transmitter and the receiver also have a double-buffered structure, so that data can be read or written during transmission or reception, enabling continuous data transfer. figure 12.14 shows the general format for synchronous serial communication. don ' t care don ' t care one un i t of transfer data (character or frame) b i t 0 ser i a l data ser i a l c l ock b i t 1 b i t 3 b i t 4 b i t 5 l sb msb b i t 2 b i t 6 b i t 7 * n ote : * hig h e x cept i n cont i nuous transfer * figure 12.14 data format in synchronous communication in synchronous serial communication, data on the communication line is output from one falling edge of the serial clock to the next. data confirmation is guaranteed at the rising edge of the serial clock. in synchronous serial communication, one character consists of data output starting with the lsb and ending with the msb. after the msb is output, the communication line holds the msb state. in synchronous mode, the sci receives data in sync hronization with the rising edge of the serial clock.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 482 of 1108 rej09b0089-0700 data transfer format a fixed 8-bit data format is used. no parity or multiprocessor bits are added. clock either an internal clock generated by the built-in baud rate generator or an external serial clock input at the sck pin can be selected, according to the setting of the c/ a bit in smr and the cke1 and cke0 bits in scr. for details of sci clock source selection, see table 12.9. when the sci is operated on an internal clock, the serial clock is output from the sck pin. eight serial clock pulses are output in the transf er of one character, and when no transfer is performed the clock is fixed high. when only receive operations are performed, however, the serial clock is output until an overrun error occurs or the re bit is cleared to 0. to perform receive operations in units of one character, an external clock should be selected as the clock source.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 483 of 1108 rej09b0089-0700 data transfer operations sci initialization (synchronous mode): before transmitting or receiving data, first clear the te and re bits in scr to 0, then initialize the sci as described below. when the operating mode, transfer format, etc., is changed, the te and re bits must be cleared to 0 before making the change using the following procedure. when the te bit is cleared to 0, the tdre flag is set to 1 and tsr is initialized. note that clearing the re bit to 0 does not change the contents of the rdrf, per, fer, and orer flags, or the contents of rdr. figure 12.15 shows a sample sci initialization flowchart. w a i t start of i n i t i a liz at i on set data transfer format i n sm r and s c m r n o y es set va l ue i n b rr cl ear te and re b i ts i n s cr to 0 [ 2 ] [ 3 ] set te or re b i t i n s cr to 1, and set rie , tie , teie , and mp ie b i ts as necessary n ote : i n s i mu l taneous transm i t and rece i ve operat i ons, the te and re b i ts shou l d both be c l eared to 0 or set to 1 s i mu l taneous l y . [4] 1 - b i t i nterva l e l apsed ? set cke 1 and cke 0 b i ts i n s cr ( te , re b i ts 0) [ 1 ] [ 1 ] set the c l ock se l ect i on i n s cr. be sure to c l ear b i ts rie , tie , teie , and mp ie , te and re , to 0 . [ 2 ] set the data transfer format i n sm r and s c m r. [ 3 ] w r i te a va l ue correspond i n g to the b i t rate to b rr. ( n ot necessary i f an e x terna l c l ock i s used . ) [4] w a i t at l east one b i t i nterva l , then set the te b i t or re b i t i n s cr to 1 . al so set the rie , tie , teie , and mp ie b i ts as necessary . sett i n g the te or re b i t enab l es the tx d or rx d p i n to be used . figure 12.15 sample sci initialization flowchart
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 484 of 1108 rej09b0089-0700 serial data transmission (synchronous mode): figure 12.16 shows a sample flowchart for serial transmission. the following procedure should be used for serial data transmission. n o [ 1 ] y es i n i t i a liz at i on start of transm i ss i on r ead t d re f l a g i n ss r[ 2 ] w r i te transm i t data to t d r and c l ear t d re f l a g i n ss r to 0 n o y es n o y es r ead ten d f l a g i n ss r [ 3 ] cl ear te b i t i n s cr to 0 t d re = 1 ? all data transm i tted ? ten d = 1 ? [ 1 ] s ci i n i t i a liz at i on : t he tx d p i n i s automat i ca ll y des ig nated as the transm i t data output p i n . [ 2 ] s ci status check and transm i t data w r i te : r ead ss r and check that the t d re f l a g i s set to 1, then w r i te transm i t data to t d r and c l ear the t d re f l a g to 0 . [ 3 ] ser i a l transm i ss i on cont i nuat i on procedure : t o cont i nue ser i a l transm i ss i on, be sure to read 1 from the t d re f l a g to conf i rm that w r i t i n g i s poss i b l e, then w r i te data to t d r , and then c l ear the t d re f l a g to 0 . c heck i n g and c l ear i n g of the t d re f l a g i s automat i c w hen the d tc i s act i vated by a transm i t - data - empty i nterrupt ( txi ) re q uest and data i s w r i tten to t d r. figure 12.16 sample serial transmission flowchart
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 485 of 1108 rej09b0089-0700 in serial transmission, the sci operates as described below. [1] the sci monitors the tdre flag in ssr, and if is 0, recognizes that data has been written to tdr, and transfers the data from tdr to tsr. [2] after transferring data from tdr to tsr, the sci sets the tdre flag to 1 and starts transmission. if the tie bit is set to 1 at this time, a transmit-data-empty interrupt (txi) is generated. when clock output mode has been set, the sci outputs 8 serial clock pulses. when use of an external clock has been specified, data is output synchronized with the input clock. the serial transmit data is sent from the txd pin starting with the lsb (bit 0) and ending with the msb (bit 7). [3] the sci checks the tdre flag at the timing for sending the msb (bit 7). if the tdre flag is cleared to 0, data is transferred from tdr to tsr, and serial transmission of the next frame is started. if the tdre flag is set to 1, the tend flag in ssr is set to 1, the msb (bit 7) is sent, and the txd pin maintains its state. if the teie bit in scr is set to 1 at this time, a tei interrupt request is generated. [4] after completion of serial transmission, the sck pin is fixed.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 486 of 1108 rej09b0089-0700 figure 12.17 shows an example of sci operation in transmission. t ransfer d i rect i on b i t 7 ser i a l data ser i a l c l ock 1 frame t d re ten d b i t 0 b i t 7b i t 0b i t 1b i t 7 b i t 6 data w r i tten to t d r and t d re f l a g c l eared to 0 i n txi i nterrupt hand li n g rout i ne tei i nterrupt re q uest g enerated txi i nterrupt re q uest g enerated txi i nterrupt re q uest g enerated figure 12.17 example of sci transmit operation serial data reception (synchronous mode): figure 12.18 shows a sample flowchart for serial reception. the following procedure should be used for serial data reception. when changing the operating mode from asynchronous to synchronous, be sure to check that the orer, per, and fer flags are all cleared to 0. the rdrf flag will not be set if the fer or per flag is set to 1, and neither transmit nor receive operations will be possible.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 487 of 1108 rej09b0089-0700 y es [ 1 ] n o i n i t i a liz at i on start of recept i on [ 2 ] n o y es r ead r d rf f l a g i n ss r [4] [ 5 ] cl ear re b i t i n s cr to 0 e rror process i n g ( c ont i nued be l o w ) [ 3 ] r ead rece i ve data i n r d r , and c l ear r d rf f l a g i n ss r to 0 n o y es o rer = 1 ? r d rf = 1 ? all data rece i ved ? r ead o rer f l a g i n ss r [ 1 ] [ 2 ] [ 3 ] [4] [ 5 ] s ci i n i t i a liz at i on : t he rx d p i n i s automat i ca ll y des ig nated as the rece i ve data i nput p i n . r ece i ve error hand li n g: i f a rece i ve error occurs, read the o rer f l a g i n ss r , and after perform i n g the appropr i ate error hand li n g , c l ear the o rer f l a g to 0 . t ransfer cannot be resumed i f the o rer f l a g i s set to 1 . s ci status check and rece i ve data read : r ead ss r and check that the r d rf f l a g i s set to 1, then read the rece i ve data i n r d r and c l ear the r d rf f l a g to 0 . t rans i t i on of the r d rf f l a g from 0 to 1 can a l so be i dent i f i ed by an rxi i nterrupt . ser i a l recept i on cont i nuat i on procedure : t o cont i nue ser i a l recept i on, before the msb (b i t 7) of the current frame i s rece i ved, f i n i sh read i n g the r d rf f l a g , read i n g r d r , and c l ear i n g the r d rf f l a g to 0 . t he r d rf f l a g i s c l eared automat i ca ll y w hen the d tc i s act i vated by a rece i ve - data - fu ll i nterrupt ( rxi ) re q uest and the r d r va l ue i s read . e rror hand li n g overrun error hand li n g [ 3 ] cl ear o rer f l a g i n ss r to 0 figure 12.18 sample seri al reception flowchart
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 488 of 1108 rej09b0089-0700 in serial reception, the sci operates as described below. [1] the sci performs internal initialization in synchronization with serial clock input or output. [2] the received data is stored in rsr in lsb-to-msb order. after reception, the sci checks whether the rdrf flag is 0 and the receive data can be transferred from rsr to rdr. if this check is passed, the rdrf flag is set to 1, and the receive data is stored in rdr. if a receive error is detected in the error check, the operation is as shown in table 12.11. neither transmit nor receive operations can be performed subsequently when a receive error has been found in the error check. [3] if the rie bit in scr is set to 1 when the rd rf flag changes to 1, a receive-data-full interrupt (rxi) request is generated. also, if the rie bit in scr is set to 1 when the orer flag changes to 1, a receive-error interrupt (eri) request is generated. figure 12.19 shows an example of sci operation in reception. b i t 7 ser i a l data ser i a l c l ock 1 frame r d rf o rer b i t 0 b i t 7 b i t 0 b i t 1 b i t 6 b i t 7 rxi i nterrupt re q uest g enerated r d r data read and r d rf f l a g c l eared to 0 i n rxi i nterrupt hand li n g rout i ne rxi i nterrupt re q uest g enerated eri i nterrupt re q uest g enerated by overrun error figure 12.19 example of sci receive operation simultaneous serial data transmissi on and reception (s ynchronous mode): figure 12.20 shows a sample flowchart for simultaneous serial transmit and receive operations. the following procedure should be used for si multaneous serial data transmit and receive operations.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 489 of 1108 rej09b0089-0700 y es [ 1 ] n o i n i t i a liz at i on start of transm i ss i on / recept i on [ 5 ] e rror hand li n g [ 3 ] r ead rece i ve data i n r d r , and c l ear r d rf f l a g i n ss r to 0 n o y es o rer = 1 ? all data rece i ved ? [ 2 ] r ead t d re f l a g i n ss r n o y es t d re = 1 ? w r i te transm i t data to t d r and c l ear t d re f l a g i n ss r to 0 n o y es r d rf = 1 ? r ead o rer f l a g i n ss r [4] r ead r d rf f l a g i n ss r cl ear te and re b i ts i n s cr to 0 n ote : w hen s wi tch i n g from transm i t or rece i ve operat i on to s i mu l taneous transm i t and rece i ve operat i ons, f i rst c l ear the te and re b i ts to 0, then set both these b i ts to 1 s i mu l taneous l y . [ 1 ] [ 2 ] [ 3 ] [4] [ 5 ] s ci i n i t i a liz at i on : t he tx d p i n i s des ig nated as the transm i t data output p i n, and the rx d p i n i s des ig nated as the rece i ve data i nput p i n, enab li n g s i mu l taneous transm i t and rece i ve operat i ons . s ci status check and transm i t data w r i te : r ead ss r and check that the t d re f l a g i s set to 1, then w r i te transm i t data to t d r and c l ear the t d re f l a g to 0 . t rans i t i on of the t d re f l a g from 0 to 1 can a l so be i dent i f i ed by a txi i nterrupt . r ece i ve error hand li n g: i f a rece i ve error occurs, read the o rer f l a g i n ss r , and after perform i n g the appropr i ate error hand li n g , c l ear the o rer f l a g to 0 . t ransm i ss i on / recept i on cannot be resumed i f the o rer f l a g i s set to 1 . s ci status check and rece i ve data read : r ead ss r and check that the r d rf f l a g i s set to 1, then read the rece i ve data i n r d r and c l ear the r d rf f l a g to 0 . t rans i t i on of the r d rf f l a g from 0 to 1 can a l so be i dent i f i ed by an rxi i nterrupt . ser i a l transm i ss i on / recept i on cont i nuat i on procedure : t o cont i nue ser i a l transm i ss i on / recept i on, before the msb (b i t 7) of the current frame i s rece i ved, f i n i sh read i n g the r d rf f l a g , read i n g r d r , and c l ear i n g the r d rf f l a g to 0 . al so, before the msb (b i t 7) of the current frame i s transm i tted, read 1 from the t d re f l a g to conf i rm that w r i t i n g i s poss i b l e . t hen w r i te data to t d r and c l ear the t d re f l a g to 0 . c heck i n g and c l ear i n g of the t d re f l a g i s automat i c w hen the d tc i s act i vated by a transm i t - data - empty i nterrupt ( txi ) re q uest and data i s w r i tten to t d r. al so, the r d rf f l a g i s c l eared automat i ca ll y w hen the d tc i s act i vated by a rece i ve - data - fu ll i nterrupt ( rxi ) re q uest and the r d r va l ue i s read . figure 12.20 sample flowchart of simultan eous serial transmit and receive operations
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 490 of 1108 rej09b0089-0700 12.4 sci interrupts the sci has four interrupt sources: the transmit-end interrupt (tei) request, receive-error interrupt (eri) request, receive-data-full interrupt (rxi) request, and transmit-data-empty interrupt (txi) request. table 12.12 shows the interrupt sources and their relative priorities. individual interrupt sources can be enabled or disabled with the tie, rie, and teie bits in the scr. each kind of interrupt request is sent to the interrupt controller independently. when the tdre flag in ssr is set to 1, a txi interrupt request is generated. when the tend flag in ssr is set to 1, a tei interrupt request is generated. a txi interrupt can activate the dtc to perform data transfer. the tdre flag is cleared to 0 automatically when data transfer is performed by the dtc. the dtc cannot be activated by a tei interrupt request. when the rdrf flag in ssr is set to 1, an rxi interrupt request is generated. when the orer, per, or fer flag in ssr is set to 1, an eri interrupt request is generated. an rxi interrupt can activate the dtc to perform data transfer. the rdrf flag is cleared to 0 automatically when data transfer is performed by the dtc. the dtc cannot be activated by an eri interrupt request. table 12.12 sci interrupt sources channel interrupt source description dtc activation priority * 0 eri interrupt due to receive error (orer, fer, or per) not possible high rxi interrupt due to receive data full state (rdrf) possible txi interrupt due to transmit data empty state (tdre) possible tei interrupt due to transmission end (tend) not possible 1 eri interrupt due to receive error (orer, fer, or per) not possible rxi interrupt due to receive data full state (rdrf) possible txi interrupt due to transmit data empty state (tdre) possible tei interrupt due to transmission end (tend) not possible low note: * this table shows the initial state immediate after a reset. relative priorities among channels can be changed by the interrupt controller.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 491 of 1108 rej09b0089-0700 a tei interrupt is requested when the tend flag is set to 1 while the teie bit is set to 1. the tend flag is cleared at the same time as the tdre flag. consequently, if a tei interrupt and a txi interrupt are requested simultaneously, the txi interrupt may be accepted first, with the result that the tdre and tend flags are cleared. note that the tei interrupt will not be accepted in this case. 12.5 usage notes the following points should be noted when using the sci. relation between writes to tdr and the tdre flag: the tdre flag in ssr is a status flag that indicates that transmit data has been transf erred from tdr to tsr. when the sci transfers data from tdr to tsr, the tdre flag is set to 1. data can be written to tdr regardless of the state of the tdre flag. however, if new data is written to tdr when the tdre flag is cleared to 0, the data stored in tdr will be lost since it has not yet been transferred to tsr. it is therefore essential to check that the tdre flag is set to 1 before writing transmit data to tdr. operation when multip le receive errors occur simultaneously: if a number of receive errors occur at the same time, the state of the status flags in ssr is as shown in table 12.13. if there is an overrun error, data is not transferred from rsr to rdr, and the receive data is lost. table 12.13 state of ssr status flags and transfer of receive data ssr status flags rdrf orer fer per receive data transfer from rsr to rdr receive error status 1 1 0 0 x overrun error 0 0 1 0 framing error 0 0 0 1 parity error 1 1 1 0 x overrun error + framing error 1 1 0 1 x overrun error + parity error 0 0 1 1 framing error + parity error 1 1 1 1 x overrun error + framing error + parity error notes: : receive data is transferred from rsr to rdr. x: receive data is not transferred from rsr to rdr.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 492 of 1108 rej09b0089-0700 break detection and processing (asynchronous mode only): when framing error (fer) detection is performed, a break can be detected by reading the rxd pin value directly. in a break, the input from the rxd pin becomes all 0s, and so the fer flag is set, and the parity error flag (per) may also be set. note that, since the sci continues the receive operation after receiving a break, even if the fer flag is cleared to 0, it will be set to 1 again. sending a break (asynchronous mode only): the txd pin has a dual function as an i/o port whose direction (input or output) is determined by dr and ddr. this can be used to send a break. between serial transmission initialization and setting of the te bit to 1, the mark state is replaced by the value of dr (the pin does not function as the txd pin until the te bit is set to 1). therefore, ddr and dr for the port corresponding to the txd pin should first be set to 1. to send a break during serial transmission, first clear dr to 0, then clear the te bit to 0. when the te bit is cleared to 0, the transmitter is initialized regardless of the current transmission state, the txd pin becomes an i/o port, and 0 is output from the txd pin. receive error flags and transmit op erations (synchrono us mode only): transmission cannot be started when a receive error flag (orer, per, or fer) is set to 1, even if the tdre flag is cleared to 0. be sure to clear the recei ve error flags to 0 before starting transmission. note also that receive error flags cannot be clear ed to 0 even if the re bit is cleared to 0. receive data sampling timing and recei ve margin in asynchronous mode: in asynchronous mode, the sci operates on a base clock with a frequency of 16 times the transfer rate. in reception, the sci samples the falling edge of th e start bit using the base clock, and performs internal synchronization. receive data is latched internally at the rising edge of the 8th pulse of the base clock. this is illustrated in figure 12.21.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 493 of 1108 rej09b0089-0700 i nterna l base c l ock 16 c l ocks 8 c l ocks r ece i ve data ( rx d) synchron iz at i on samp li n g t i m i n g start b i td0d1 data samp li n g t i m i n g 15 0 7 15 0 07 figure 12.21 receive data samplin g timing in asynchronous mode thus the receive margin in asynchronous mode is given by formula (1) below. m = | (0.5 ? 1 2n ) ? (l ? 0.5) f ? | d ? 0.5 | n (1 + f) | 100% ... formula (1) where m: receive margin (%) n: ratio of bit rate to clock (n = 16) d: clock duty (d = 0 to 1.0) l: frame length (l = 9 to 12) f: absolute value of clock rate deviation assuming values of f = 0 and d = 0.5 in formula (1), a receive margin of 46.875% is given by formula (2) below. when d = 0.5 and f = 0, m = (0.5 ? 1 2 16 ) 100% = 46.875% ... formula (2) however, this is a theoretical value, and a margin of 20% to 30% should be allowed in system design.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 494 of 1108 rej09b0089-0700 restrictions on use of dtc ? when an external clock source is used as the serial clock, the transmit clock should not be input until at least 5 clock cycles after tdr is updated by the dtc. misoperation may occur if the transmit clock is input within 4 clocks after tdr is updated. (figure 12.22) ? when rdr is read by the dtc, be sure to set the activation source to the relevant sci receive- data-full interrupt (rxi). t d0 l sb ser i a l data s ck d1 d3 d 4 d5 d2 d6 d7 n ote : w hen operat i n g on an e x terna l c l ock, set t > 4 c l ocks . t d re figure 12.22 example of synchronous transmission using dtc operation in case of mode transition ? transmission operation should be stopped (by clearing te, tie, and teie to 0) before making a module stop mode or software standby mode transition. tsr, tdr, and ssr are reset. the output pin states in module stop mode or software standby mode depend on the port settings, and becomes high-level output after the relevant mode is cleared. if a transition is made during transmission, the data being transmitted will be undefined. when transmitting without changing the transmit mode after the relevant mode is cleared, transmission can be started by setting te to 1 again, and performing the following sequence: ssr read tdr write tdre clearance. to transmit with a different transmit mode after clearing the relevant mode, the procedure must be started again from initialization. figure 12.23 shows a sample flowchart for mode transition during transmission. port pin states are shown in figures 12.24 and 12.25. operation should also be stopped (by clearing te, tie, and teie to 0) before making a transition from transmission by dtc transfer to module stop mode or software standby mode transition. to perform transmission with the dtc after the relevant mode is cleared, setting te and tie to 1 will set the txi flag and start dtc transmission.
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 495 of 1108 rej09b0089-0700 ? reception receive operation should be stopped (by clearing re to 0) before making a module stop mode or software standby mode transition. rsr, rdr, and ssr are reset. if a transition is made without stopping operation, the data being received will be invalid. to continue receiving without changing the receptio n mode after the relevant mode is cleared, set re to 1 before starting recep tion. to receive with a different receive mode, the procedure must be started again from initialization. figure 12.26 shows a sample flowchart for mode transition during reception. r ead ten d f l a g i n ss r te = 0 t rans i t i on to soft w are standby mode, etc . exi t from soft w are standby mode, etc . c han g e operat i n g mode ? n o all data transm i tted ? ten d = 1 y es y es y es n o n o [ 1 ] [ 3 ] [ 2 ] te = 1 i n i t i a liz at i on < start of transm i ss i on > [ 1 ] data be i n g transm i tted i s i nterrupted . a fter e xi t i n g soft w are standby mode, etc . , norma l c p u transm i ss i on i s poss i b l e by sett i n g te to 1, read i n g ss r , w r i t i n g t d r , and c l ear i n g t d re to 0, but note that i f the d tc has been act i vated, the rema i n i n g data i n d tcra m will be transm i tted w hen te and tie are set to 1 . [ 2 ] i f tie and teie are set to 1, c l ear them to 0 i n the same w ay . [ 3 ] i nc l udes modu l e stop mode . figure 12.23 sample flowchart for mode transition during transmission
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 496 of 1108 rej09b0089-0700 s ck output p i n te b i t tx d output p i n port i nput / output hig h output port i nput / output hig h output start stop start of transm i ss i on e nd of transm i ss i on port i nput / output s ci tx d output port s ci tx d output port t rans i t i on to soft w are standby exi t from soft w are standby figure 12.24 asynchronous transmission using internal clock port i nput / output l ast tx d b i t he l d hig h output * port i nput / output mark i n g output port i nput / output s ci tx d output port port n ote : * i n i t i a liz ed by soft w are standby . s ck output p i n te b i t tx d output p i n s ci tx d output start of transm i ss i on e nd of transm i ss i on t rans i t i on to soft w are standby exi t from soft w are standby figure 12.25 synchronous transmission using internal clock
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 497 of 1108 rej09b0089-0700 re = 0 t rans i t i on to soft w are standby mode, etc . r ead rece i ve data i n r d r r ead r d rf f l a g i n ss r exi t from soft w are standby mode, etc . c han g e operat i n g mode ? n o r d rf = 1 y es y es n o [ 1 ] [ 2 ] re = 1 i n i t i a liz at i on < start of recept i on > [ 1 ] r ece i ve data be i n g rece i ved becomes i nva li d . [ 2 ] i nc l udes modu l e stop mode . figure 12.26 sample flowchart for mode transition during reception
section 12 serial communication interface (sci) rev.7.00 feb. 14, 2007 page 498 of 1108 rej09b0089-0700
section 13 smart card interface rev.7.00 feb. 14, 2007 page 499 of 1108 rej09b0089-0700 section 13 smart card interface 13.1 overview the sci supports an ic card (smart card) interface conforming to iso/iec 7816-3 (identification card) as a serial communication interface extension function. switching between the normal serial communication interface and the smart card interface is carried out by means of a register setting. 13.1.1 features features of the smart card interface supported by the chip is as follows. ? asynchronous mode ? data length: 8 bits ? parity bit generation and checking ? transmission of error signal (parity error) in receive mode ? error signal detection and automatic data retransmission in transmit mode ? direct convention and inverse convention both supported ? built-in baud rate generator allows any bit rate to be selected ? three interrupt sources ? three interrupt sources (transmit-data-empty, receive-data-full, and transmit/receive-error) that can issue requests independently ? the transmit-data-empty and receive-data-full interrupts can activate the data transfer controller (dtc) to execute data transfer
section 13 smart card interface rev.7.00 feb. 14, 2007 page 500 of 1108 rej09b0089-0700 13.1.2 block diagram figure 13.1 shows a block diagram of the smart card interface. bus interface tdr rsr rdr module data bus tsr scmr ssr scr transmission/ reception control brr baud rate generator internal data bus rxd txd sck parity generation parity check clock /4 /16 /64 txi rxi eri smr legend: scmr: smart card mode register rsr: receive shift register rdr: receive data register tsr: transmit shift register tdr: transmit data register smr: serial mode register scr: serial control register ssr: serial status register brr: bit rate register figure 13.1 block diagram of smart card interface
section 13 smart card interface rev.7.00 feb. 14, 2007 page 501 of 1108 rej09b0089-0700 13.1.3 pin configuration table 13.1 shows the smart card interface pin configuration. table 13.1 smart card interface pins channel pin name symbol i/o function 0 serial clock pin 0 sck0 i/o sci0 clock input/output receive data pin 0 rxd0 input sci0 receive data input transmit data pin 0 txd0 output sci0 transmit data output 1 serial clock pin 1 sck1 i/o sci1 clock input/output receive data pin 1 rxd1 input sci1 receive data input transmit data pin 1 txd1 output sci1 transmit data output
section 13 smart card interface rev.7.00 feb. 14, 2007 page 502 of 1108 rej09b0089-0700 13.1.4 register configuration table 13.2 shows the registers used by the smart card interface. details of smr, brr, scr, tdr, rdr, and mstpcr are the same as for the normal sci function: see the register descriptions in section 12, serial communication interface (sci). table 13.2 smart card interface registers channel name abbreviation r/w initial value address * 2 0 serial mode register 0 smr0 r/w h'00 h'ff78 bit rate register 0 brr0 r/w h'ff h'ff79 serial control register 0 scr0 r/w h'00 h'ff7a transmit data register 0 tdr0 r/w h'ff h'ff7b serial status register 0 ssr0 r/(w) * 1 h'84 h'ff7c receive data register 0 rdr0 r h'00 h'ff7d smart card mode register 0 scmr0 r/w h'f2 h'ff7e 1 serial mode register 1 smr1 r/w h'00 h'ff80 bit rate register 1 brr1 r/w h'ff h'ff81 serial control register 1 scr1 r/w h'00 h'ff82 transmit data register 1 tdr1 r/w h'ff h'ff83 serial status register 1 ssr1 r/(w) * 1 h'84 h'ff84 receive data register 1 rdr1 r h'00 h'ff85 smart card mode register 1 scmr1 r/w h'f2 h'ff86 all module stop control register mstpcr r/w h'3fff h'ff3c notes: 1. can only be written with 0 for flag clearing. 2. lower 16 bits of the address.
section 13 smart card interface rev.7.00 feb. 14, 2007 page 503 of 1108 rej09b0089-0700 13.2 register descriptions registers added with the smart card interface and bits for which the function changes are described here. 13.2.1 smart card mode register (scmr) bit : 7 6 5 4 3 2 1 0 ? ? ? ? sdir sinv ? smif initial value : 1 1 1 1 0 0 1 0 r/w : ? ? ? ? r/w r/w ? r/w scmr is an 8-bit readable/writable register that selects the smart card interface function. scmr is initialized to h'f2 by a reset and in hardware standby mode. in software standby mode and module stop mode it retains its previous state. bits 7 to 4?reserved: these bits cannot be modified and are always read as 1. bit 3?smart card data transfer direction (sdir): selects the serial/parallel conversion format. bit 3 sdir description 0 tdr contents are transmitted lsb-first (initial value) receive data is stored in rdr lsb-first 1 tdr contents are transmitted msb-first receive data is stored in rdr msb-first bit 2?smart card data invert (sinv): specifies inversion of the data logic level. this function is used together with the sdir bit for communication with an inverse convention card. the sinv bit does not affect the logic level of the parity bit. for parity-r elated setting procedures, see section 13.3.4, register settings.
section 13 smart card interface rev.7.00 feb. 14, 2007 page 504 of 1108 rej09b0089-0700 bit 2 sinv description 0 tdr contents are transmitted as they are (initial value) receive data is stored as it is in rdr 1 tdr contents are inverted before being transmitted receive data is stored in inverted form in rdr bit 1?reserved: read-only bit, always read as 1. bit 0?smart card interface mode select (smif): enables or disables the smart card interface function. bit 0 smif description 0 smart card interface function is disabled (initial value) 1 smart card interface function is enabled 13.2.2 serial status register (ssr) bit : 7 6 5 4 3 2 1 0 tdre rdrf orer ers per tend mpb mpbt initial value : 1 0 0 0 0 1 0 0 r/w : r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r r r/w note: * only 0 can be written to bits 7 to 3, to clear these flags. bit 4 of ssr has a different function in smart card interface mode. coupled with this, the setting conditions for bit 2, tend, are also different. bits 7 to 5? operate in the same way as for the normal sci. for details, see section 12.2.7, serial status register (ssr). bit 4?error signal status (ers): in smart card interface mode, bit 4 indicates the status of the error signal sent back from the receiving end in transmission. framing errors are not detected in smart card interface mode.
section 13 smart card interface rev.7.00 feb. 14, 2007 page 505 of 1108 rej09b0089-0700 bit 4 ers description 0 indicates data received normally with no error signal [clearing conditions] (initial value) ? upon reset, and in standby mode or module stop mode ? when 0 is written to ers after reading ers = 1 1 indicates an error signal was sent showing detection of a parity error at the receiving side [setting condition] when the low level of the error signal is sampled note: clearing the te bit in scr to 0 does not affect the ers flag, which retains its previous state. bits 3 to 0? operate in the same way as for the normal sci. for details, see section 12.2.7, serial status register (ssr). however, the setting conditions for the tend bit, are as shown below. bit 2 tend description 0 indicates transfer in progress [clearing conditions] ? when 0 is written to tdre after reading tdre = 1 ? when the dtc is activated by a txi interrupt and writes data to tdr 1 indicates transfer complete [setting conditions] (initial value) ? upon reset, and in standby mode or module stop mode ? when the te bit in scr is 0 and the ers bit is also 0 ? when tdre = 1 and ers = 0 (normal transmission) 2.5 etu after transmission of a 1-byte serial character when gm = 0 and blk = 0 ? when tdre = 1 and ers = 0 (normal transmission) 1.5 etu after transmission of a 1-byte serial character when gm = 0 and blk = 1 ? when tdre = 1 and ers = 0 (normal transmission) 1.0 etu after transmission of a 1-byte serial character when gm = 1 and blk = 0 ? when tdre = 1 and ers = 0 (normal transmission) 1.0 etu after transmission of a 1-byte serial character when gm = 1 and blk = 1 note: etu: elementary time unit (time for transfer of 1 bit)
section 13 smart card interface rev.7.00 feb. 14, 2007 page 506 of 1108 rej09b0089-0700 13.2.3 serial mode register (smr) bit : 7 6 5 4 3 2 1 0 gm blk pe * o/ e bcp1 bcp0 cks1 cks0 initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w note: * when the smart card interface is used, set a value of 1 in bit 5. the function of bits 7, 6, 3, and 2 of smr changes in smart card interface mode. bit 7?gsm mode (gm): sets the smart card interface function to gsm mode. this bit is cleared to 0 when the normal smart card interface is used. in gsm mode, this bit is set to 1, the timing of setting of the tend flag that indicates transmission completion is advanced, and clock output control mode addition is performed. the contents of the clock output control mode addition are specified by bits 1 and 0 of the serial control register (scr). bit 7 gm description 0 normal smart card interface mode operation (initial value) ? tend flag generation 12.5 etu (11.5 etu in block transfer mode) after beginning of start bit ? clock output on/off control only 1 gsm mode smart card interface mode operation ? tend flag generation 11.0 etu after beginning of start bit ? high/low fixing control possible in addition to clock output on/off control (set by scr) note: etu: elementary time unit (time for transfer of 1 bit)
section 13 smart card interface rev.7.00 feb. 14, 2007 page 507 of 1108 rej09b0089-0700 bit 6?block transfer mode (blk): selects block transfer mode. bit 6 blk description 0 normal smart card interface mode operation (initial value) ? error signal transmission/detection and automatic data retransmission performed ? txi interrupt generated by tend flag ? tend flag set 12.5 etu after start of transmission (11.0 etu in gsm mode) 1 block transfer mode operation ? error signal transmission/detection and automatic data retransmission not performed ? txi interrupt generated by tdre flag ? tend flag set 11.5 etu after start of transmission (11.0 etu in gsm mode) note: etu: elementary time unit (time for transfer of 1 bit) bits 3 and 2?base clock pulse 1 and 2 (bcp1, bcp0): these bits specify the number of base clock periods in a 1-bit transfer interval on the smart card interface. bit 3 bcp1 bit 2 bcp0 description 0 0 32 clock periods (initial value) 1 64 clock periods 1 0 372 clock periods 1 256 clock periods bits 5, 4, 1, and 0? operate in the same way as for the normal sci. for details, see section 12.2.5, serial mode register (smr).
section 13 smart card interface rev.7.00 feb. 14, 2007 page 508 of 1108 rej09b0089-0700 13.2.4 serial control register (scr) bit : 7 6 5 4 3 2 1 0 tie rie te re mpie teie cke1 cke0 initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w in smart card interface mode, the function of bits 1 and 0 of scr changes when bit 7 of the serial mode register (smr) is set to 1. bits 7 to 2? operate in the same way as for the normal sci. for details, see section 12.2.6, serial control register (scr). bits 1 and 0?clock enable 1 and 0 (cke1, cke0): these bits are used to select the sci clock source and enable or disable clock output from the sck pin. in smart card interface mode, in addition to the normal switching between clock output enabling and disabling, the clock output can be specified as being fixed high or low. scmr smr scr setting smif gm cke1 cke0 sck pin function 0 see the sci specification 1 0 0 0 operates as port i/o pin 1 0 0 1 outputs clock as sck output pin 1 1 0 0 operates as sck output pin, with output fixed low 1 1 0 1 outputs clock as sck output pin 1 1 1 0 operates as sck output pin, with output fixed high 1 1 1 1 outputs clock as sck output pin
section 13 smart card interface rev.7.00 feb. 14, 2007 page 509 of 1108 rej09b0089-0700 13.3 operation 13.3.1 overview the main functions of the smart card interface are as follows. ? one frame consists of 8-bit data plus a parity bit. ? in transmission, a guard time of at least 2 etu (1 etu in block transfer mode) (elementary time unit: the time for transfer of 1 bit) is left between the end of the parity bit and the start of the next frame. ? if a parity error is detected during reception, a low error signal level is output for one etu period, 10.5 etu after the start bit. (this does not apply to block transfer mode.) ? if the error signal is sampled during transmission, the same data is transmitted automatically after the elapse of 2 etu or longer. (this does not apply to block transfer mode.) ? only asynchronous communication is supported; there is no synchronous communication function.
section 13 smart card interface rev.7.00 feb. 14, 2007 page 510 of 1108 rej09b0089-0700 13.3.2 pin connections figure 13.2 shows a schematic diagram of smart card interface related pin connections. in communication with an ic card, since both transmission and reception are carried out on a single data communication line, the chip?s txd pin and rxd pin should both be connected to the line, as shown in the figure. the data communication line should be pulled up to the v cc power supply with a resistor. when the clock generated on the smart card interface is used by an ic card, the sck pin output is input to the clk pin of the ic card. no connection is needed if the ic card uses an internal clock. chip port output is used as the reset signal. other pins must normally be connected to the power supply or ground. txd rxd sck rx (port) chip i/o clk rst v cc connected equipment ic card data line clock line reset line figure 13.2 schematic diagram of sm art card interfa ce pin connections note: if an ic card is not connected, and the te and re bits are both set to 1, closed transmission/reception is possible, enabli ng self-diagnosis to be carried out.
section 13 smart card interface rev.7.00 feb. 14, 2007 page 511 of 1108 rej09b0089-0700 13.3.3 data format normal transfer mode: figure 13.3 shows the smart card interface data format in the normal transfer mode. in reception in this mode, a parity ch eck is carried out on each frame. if an error is detected an error signal is sent back to the transmitting end, and retransmission of the data is requested. if an error signal is sampled during transmission, the same data is retransmitted. ds d0 d1 d2 d3 d4 d5 d6 d7 dp when there is no parity error transmitting station output ds d0 d1 d2 d3 d4 d5 d6 d7 dp when a parity error occurs transmitting station output de receiving station output legend: ds: start bit d0 to d7: data bits dp: parity bit de: error signal figure 13.3 smart card interface data format
section 13 smart card interface rev.7.00 feb. 14, 2007 page 512 of 1108 rej09b0089-0700 the operation sequence is as follows. [1] when the data line is not in use it is in the high-impedance state, and is fixed high with a pull- up resistor. [2] the transmitting station starts transfer of one frame of data. the data frame starts with a start bit (ds, low-level), followed by 8 data bits (d0 to d7) and a parity bit (dp). [3] with the smart card interface, the data line then returns to the high-impedance state. the data line is pulled high with a pull-up resistor. [4] the receiving station carries out a parity check. if there is no parity error and the data is received normally, the receiving station waits for reception of the next data. if a parity error occurs, however, the receiving station outputs an error signal (de, low-level) to request retransmission of the data. after outputting the error signal for the prescribed length of time, the receiving station places the signal line in the high-impedance state again. the signal line is pulled high again by a pull-up resistor. [5] if the transmitting station does not receive an error signal, it proceeds to transmit the next data frame. if it does receive an error signal, however, it returns to step [2] and retransmits the data in which the error occurred. block transfer mode: the operation sequence in block transfer mode is as follows. [1] when the data line is not in use it is in the high-impedance state, and is fixed high with a pull- up resistor. [2] the transmitting station starts transfer of one frame of data. the data frame starts with a start bit (ds, low-level), followed by 8 data bits (d0 to d7) and a parity bit (dp). [3] with the smart card interface, the data line then returns to the high-impedance state. the data line is pulled high with a pull-up resistor. [4] the receiving station carries out a parity check, but does not output an error signal even if an error has occurred. since subsequent receive operations cannot be carried out if an error occurs, the error flag must be cleared to 0 before the parity bit for the next frame is received. [5] the transmitting station proceeds to transmit the next data frame.
section 13 smart card interface rev.7.00 feb. 14, 2007 page 513 of 1108 rej09b0089-0700 13.3.4 register settings table 13.3 shows a bit map of the registers used by the smart card interface. bits indicated as 0 or 1 must be set to the value shown. the setting of other bits is described below. table 13.3 smart card interface register settings bit register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 smr gm blk 1 o/ e bcp1 bcp0 cks1 cks0 brr brr7 brr6 brr5 brr4 brr3 brr2 brr1 brr0 scr tie rie te re 0 0 cke1 * cke0 tdr tdr7 tdr6 tdr5 tdr4 tdr3 tdr2 tdr1 tdr0 ssr tdre rdrf orer ers per tend 0 0 rdr rdr7 rdr6 rdr5 rdr4 rdr3 rdr2 rdr1 rdr0 scmr ? ? ? ? sdir sinv ? smif notes: ? : unused bit. * the cke1 bit must be cleared to 0 when the gm bit in smr is cleared to 0. smr settings: the gm bit is cleared to 0 in normal smart card interface mode, and set to 1 in gsm mode. the o/ e bit is cleared to 0 if the ic card is of the direct convention type, and set to 1 if of the inverse convention type. bits cks1 and cks0 select the clock source of the built-in baud rate generator, and bits bcp1 and bcp0 select the number of base clock cycles during transfer of one bit. for details, see section 13.3.5, clock. the blk bit is cleared to 0 when using the norm al smart card interface mode, and set to 1 when using block transfer mode. brr setting: brr is used to set the bit rate. see section 13.3.5, clock, for the method of calculating the value to be set. scr settings: the function of the tie, rie, te, and re bits is the same as for the normal sci. for details, see section 12, serial communication interface (sci).
section 13 smart card interface rev.7.00 feb. 14, 2007 page 514 of 1108 rej09b0089-0700 bits cke1 and cke0 specify the clock output. when the gm bit in smr is cleared to 0, set these bits to b'00 if a clock is not to be output, or to b'01 if a clock is to be output. when the gm bit in smr is set to 1, clock output is performed. the clock output can also be fixed high or low. smart card mode register (scmr) settings: the sdir bit is cleared to 0 if the ic card is of the direct convention type, and set to 1 if of the inverse convention type. the sinv bit is cleared to 0 if the ic card is of the direct convention type, and set to 1 if of the inverse convention type. the smif bit is set to 1 when the smart card interface is used. examples of register settings and the waveform of the start character are shown below for the two types of ic card (direct convention and inverse convention). ? direct convention (sdir = sinv = o/ e = 0) ds d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 dp azzazzzaaz ( z )( z ) state with the direct convention type, the logic 1 level corresponds to state z and the logic 0 level to state a, and transfer is performed in lsb-first order. the start character data above is h'3b. the parity bit is 1 since even parity is stipulated for the smart card. ? inverse convention (sdir = sinv = o/ e = 1) ds d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 dp azzaaaaaaz ( z )( z ) state with the inverse convention type, the logic 1 level corresponds to state a and the logic 0 level to state z, and transfer is performed in msb-first order. the start character data above is h'3f. the parity bit is 0, corresponding to state z, since even parity is stipulated for the smart card. with the chip, inversion specified by the sinv bit applies only to the data bits, d7 to d0. for parity bit inversion, the o/ e bit in smr should be set to odd parity mode (the same applies to both transmission and reception).
section 13 smart card interface rev.7.00 feb. 14, 2007 page 515 of 1108 rej09b0089-0700 13.3.5 clock only an internal clock generated by the built-in baud rate generator can be used as the transmit/receive clock for the smart card interface. the bit rate is set with brr and the cks1, cks0, bcp1, and bcp0 bits in smr. the formula for calculating the bit rate is as shown below. table 13.5 shows some sample bit rates. if clock output is selected by setting cke0 to 1, the clock is output from the sck pin. the clock frequency is determined by the bit rate and the setting of bits bcp1 and bcp0. b = s 2 2n+1 (n + 1) 10 6 where n = value set in brr (0 n 255) b = bit rate (bits/s) = operating frequency (mhz) n = see table 13.4 s = number of internal clock cycles in 1-bit period set by bits bcp1 and bcp0 table 13.4 correspondence be tween n and cks1, cks0 n cks1 cks0 0 0 0 1 1 2 1 0 3 1 table 13.5 examples of bit rate b (bits/s) for various brr settings (when n = 0 and s = 372) (mhz) n 10.00 10.714 13.00 14.285 16.00 18.00 20.00 25.00 0 13441 14400 17473 19200 21505 24194 26882 33602 1 6720 7200 8737 9600 10753 12097 13441 16801 2 4480 4800 5824 6400 7168 8065 8961 11201 note: bit rates are rounded to the nearest whole number.
section 13 smart card interface rev.7.00 feb. 14, 2007 page 516 of 1108 rej09b0089-0700 the method of calculating the value to be set in the bit rate register (brr) from the operating frequency and bit rate, on the other hand, is shown below. n is an integer, 0 n 255, and the smaller error is specified. n = s 2 2n+1 b 10 6 ? 1 table 13.6 examples of brr settings for bit rate b (bits/s) (when n = 0 and s = 372) (mhz) 7.1424 10.00 10.7136 13.00 14.2848 16.00 18.00 20.00 25.00 bits/s n error n error n error n error n error n error n error n error n error 9600 0 0.00 1 30 1 25 1 8.99 1 0.00 1 12.01 2 15.99 2 6.60 3 12.49 table 13.7 maximum bit rate at various f requencies (smart card interface mode) (when s = 372) (mhz) maximum bit rate (bits/s) n n 7.1424 9600 0 0 10.00 13441 0 0 10.7136 14400 0 0 13.00 17473 0 0 14.2848 19200 0 0 16.00 21505 0 0 18.00 24194 0 0 20.00 26882 0 0 25.00 33602 0 0 the bit rate error is given by the following formula: error (%) = ( s 2 2n+1 b (n + 1) 10 6 ? 1) 100
section 13 smart card interface rev.7.00 feb. 14, 2007 page 517 of 1108 rej09b0089-0700 13.3.6 data transfer operations initialization: before transmitting or receiving data, initialize the sci as described below. initialization is also necessary when switching from transmit mode to receive mode, or vice versa. [1] clear the te and re bits in scr to 0. [2] clear the error flags ers, per, and orer in ssr to 0. [3] set the gm, blk, o/ e , bcp1, bcp0, cks1, and cks0 bits in smr, and set the pe bit to 1. [4] set the smif, sdir, and sinv bits in scmr. when the smif bit is set to 1, the txd and rxd pins are both switched from ports to sci pins, and are placed in the high-impedance state. [5] set the value corresponding to the bit rate in brr. [6] set the cke1 and cke0 bits in scr. clear th e tie, rie, te, re, mpie, and teie bits to 0. if the cke0 bit is set to 1, the clock is output from the sck pin. [7] wait at least one bit interval, then set the tie, rie, te, and re bits in scr. do not set the te bit and re bit at the same time, except for self-diagnosis.
section 13 smart card interface rev.7.00 feb. 14, 2007 page 518 of 1108 rej09b0089-0700 serial data transmission (except block transfer mode): as data transmission in smart card mode involves error signal sampling and retransmission processing, the processing procedure is different from that for the normal sci. figure 13.4 shows a flowchart for transmitting, and figure 13.5 shows the relation between a transmit operation and the internal registers. [1] perform smart card interface mode initialization as described above in initialization. [2] check that the ers error flag in ssr is cleared to 0. [3] repeat steps [2] and [3] until it can be confirmed that the tend flag in ssr is set to 1. [4] write the transmit data to tdr, clear the tdre flag to 0, and perform the transmit operation. the tend flag is cleared to 0. [5] when transmitting data continuously, go back to step [2]. [6] to end transmission, clear the te bit to 0. with the above processing, interrupt handling or data transfer by the dtc is possible. if transmission ends and the tend flag is set to 1 while the tie bit is set to 1 and interrupt requests are enabled, a transmit-data-empty interrupt (txi) request will be generated. if an error occurs in transmission and the ers flag is set to 1 while the rie bit is set to 1 and interrupt requests are enabled, a transmit/receive-error interrupt (eri) request will be generated. the timing for setting the tend flag depends on the value of the gm bit in smr. the tend flag setting timing is shown in figure 13.6. if the dtc is activated by a txi request, the number of bytes set in the dtc can be transmitted automatically, including automatic retransmission. for details, see interrupt operations and data transfer operation by dtc below. note: for details of operation in block transfer mode, see section 12.3.2, operation in asynchronous mode.
section 13 smart card interface rev.7.00 feb. 14, 2007 page 519 of 1108 rej09b0089-0700 initialization no yes clear te bit to 0 start of transmission start no no no yes yes yes yes no end write data to tdr, and clear tdre flag in ssr to 0 error handling error handling tend = 1 ? a ll data transmitted? tend = 1 ? ers = 0 ? ers = 0 ? figure 13.4 sample transmission flowchart
section 13 smart card interface rev.7.00 feb. 14, 2007 page 520 of 1108 rej09b0089-0700 (1) data write tdr tsr (shift register) data 1 (2) transfer from tdr to tsr data 1 data 1 ; data remains in tdr (3) serial data output note: when the ers flag is set, it should be cleared until transfer of the last bit (d7 in lsb-first transmission, d0 in msb-first transmission) of the next transfer data to be transmitted has been completed. in case of normal transmission: tend flag is set in case of transmit error: ers flag is set steps (2) and (3) above are repeated until the tend flag is set i/o signal line output data 1 data 1 figure 13.5 relation between transmit operation and internal registers ds d0 d1 d2 d3 d4 d5 d6 d7 dp i/o data 12.5 etu txi (tend interrupt) note: etu: elementary time unit (time for transfer of 1 bit) 11.0 etu de guard time when gm = 1 legend: ds: start bit d0 to d7: data bits dp: parity bit de: error signal when gm = 0 figure 13.6 tend flag generation timing in transmission
section 13 smart card interface rev.7.00 feb. 14, 2007 page 521 of 1108 rej09b0089-0700 serial data recep tion (except block transfer mode): data reception in smart card mode uses the same processing procedure as for the normal sci. figure 13.7 shows an example of the transmission processing flow. [1] perform smart card interface mode initialization as described above in initialization. [2] check that the orer flag and per flag in ssr are cleared to 0. if either is set, perform the appropriate receive error handling, then clear both the orer and the per flag to 0. [3] repeat steps [2] and [3] until it can be confirmed that the rdrf flag is set to 1. [4] read the receive data from rdr. [5] when receiving data continuously, clear the rdrf flag to 0 and go back to step [2]. [6] to end reception, cl ear the re bit to 0. initialization read rdr and clear rdrf flag in ssr to 0 clear re bit to 0 start of reception start error handling no no no yes yes orer = 0 and per = 0? rdrf = 1? all data received? yes figure 13.7 sample reception flowchart
section 13 smart card interface rev.7.00 feb. 14, 2007 page 522 of 1108 rej09b0089-0700 with the above processing, interrupt handling or data transfer by the dtc is possible. if reception ends and the rdrf flag is set to 1 while the rie bit is set to 1 and interrupt requests are enabled, a receive data full interrupt (rxi) request will be generated. if an error occurs in reception and either the orer flag or the per flag is set to 1, a transmit/receive-error interrupt (eri) request will be generated. if the dtc is activated by an rxi request, the receive data in which the error occurred is skipped, and only the number of bytes of receive data set in the dtc are transferred. for details, see interrupt operation and data transfer operation by dtc below. if a parity error occurs during reception and th e per is set to 1, the received data is still transferred to rdr, and therefore this data can be read. note: for details of operation in block transfer mode, see section 12.3.2, operation in asynchronous mode. mode switching operation: when switching from receive mode to transmit mode, first confirm that the receive operation has been completed, then start from initialization, clearing re bit to 0 and setting te bit to 1. the rdrf flag or the per and orer flags can be used to check that the receive operation has been completed. when switching from transmit mode to receive mode, first confirm that the transmit operation has been completed, then start from initialization, clearing te bit to 0 and setting re bit to 1. the tend flag can be used to check that the transmit operation has been completed. fixing clock output: when the gsm bit in smr is set to 1, the clock output can be fixed with bits cke1 and cke0 in scr. at this time, the minimum clock pulse width can be made the specified width. figure 13.8 shows the timing for fixing the clock output. in this example, gsm is set to 1, cke1 is cleared to 0, and the cke0 bit is controlled.
section 13 smart card interface rev.7.00 feb. 14, 2007 page 523 of 1108 rej09b0089-0700 sck specified pulse width scr write (cke 0 = 0 ) scr write (cke 0 = 1 ) specified pulse width figure 13.8 timing for fixing clock output interrupt operation (except block transfer mode): there are three interrupt sources in smart card interface mode: transmit-data-empty interrupt (txi) requests, transmit/receive-error interrupt (eri) requests, and receive-data-full interrupt (rxi) requests. the transmit-end interrupt (tei) request is not used in this mode. when the tend flag in ssr is set to 1, a txi interrupt request is generated. when the rdrf flag in ssr is set to 1, an rxi interrupt request is generated. when any of flags orer, per, and ers in ssr is se t to 1, an eri interrupt request is generated. the relationship between the operating states and interrupt sources is shown in table 13.8. note: for details of operation in block transfer mode, see section 12.4, sci interrupts. table 13.8 smart card mode operating states and interrupt sources operating state flag enable bit interrupt source dtc activation transmit mode normal operation tend tie txi possible error ers rie eri not possible receive mode normal operation rdrf rie rxi possible error per, orer rie eri not possible
section 13 smart card interface rev.7.00 feb. 14, 2007 page 524 of 1108 rej09b0089-0700 data transfer operation by dtc: in smart card mode, as with the normal sci, transfer can be carried out using the dtc. in a transmit operation, the tdre flag is also set to 1 at the same time as the tend flag in ssr, and a txi interrupt is generated. if the txi request is designated beforehand as a dtc activation source, the dtc will be activated by the txi request, and transfer of the transmit data will be carried out. the tdre and tend flags are automatically cleared to 0 when data transfer is performed by the dtc. in the event of an error, the sci retransmits the same data automatically. thus, the number of bytes specified by the sci is transmitted automatically even in retransmission following an error. howe ver, the ers flag is not cleared automatically when an error occurs, and so the rie bit should be set to 1 beforehand so that an eri request will be generated in the event of an error, and the ers flag will be cleared. when performing transfer using the dtc, it is essential to set and enable the dtc before carrying out sci setting. for details of the dtc setting procedures, see section 7, data transfer controller. in a receive operation, an rxi interrupt request is generated when the rdrf flag in ssr is set to 1. if the rxi request is designated beforehand as a dtc activation source, the dtc will be activated by the rxi request, and transfer of the receive data will be carried out. the rdrf flag is cleared to 0 automatically when data transfer is pe rformed by the dtc. if an error occurs, an error flag is set but the rdrf flag is not. conseque ntly, the dtc is not activated, but instead, an eri interrupt request is sent to the cpu. ther efore, the error flag should be cleared. note: for details of operation in block transfer mode, see section 12.4, sci interrupts.
section 13 smart card interface rev.7.00 feb. 14, 2007 page 525 of 1108 rej09b0089-0700 13.3.7 operation in gsm mode switching the mode: when switching between smart card interface mode and software standby mode, the following switching procedure should be followed in order to maintain the clock duty. ? when changing from smart card interface mode to software standby mode [1] set the data register (dr) and data direction register (ddr) corresponding to the sck pin to the value for the fixed output state in software standby mode. [2] write 0 to the te bit and re bit in the serial control register (scr) to halt the transmit/receive operation. at the same time, set the cke1 bit to the value for the fixed output state in software standby mode. [3] write 0 to the cke0 bit in scr to halt the clock. [4] wait for one serial clock period. during this interval, clock output is fixed at the specified level, with the duty preserved. [5] write h'00 to smr and scmr. [6] make the transition to the software standby state. ? when returning to smart card interface mode from software standby mode [7] exit the software standby state. [8] set the cke1 bit in scr to the value for the fixed output state (current sck pin state) when software standby mode is initiated. [9] set smart card interface mode and output the clock. signal generation is started with the normal duty. [ 1 ] [ 2 ] [ 3 ] [4] [ 5 ] [ 6 ] [ 7 ] [8] [9] software standby normal operation normal operation figure 13.9 clock halt and restart procedure
section 13 smart card interface rev.7.00 feb. 14, 2007 page 526 of 1108 rej09b0089-0700 powering on: to secure the clock duty from power-on, the following switching procedure should be followed. [1] the initial state is port input and high impedance. use a pull-up resistor or pull-down resistor to fix the potential. [2] fix the sck pin to the specified output level with the cke1 bit in scr. [3] set smr and scmr, and switch to smart card mode operation. [4] set the cke0 bit in scr to 1 to start clock output. 13.3.8 operation in block transfer mode operation in block transfer mode is the same as in sci asynchronous mode, except for the following points. for details, see section 12.3.2, operation in asynchronous mode. data format: the data format is 8 bits with parity. ther e is no stop bit, but there is a guard time of 2 or more bits (1 or more bits in reception). also, except during transmission (with start bit, data bits, and parity bit), the transmission pins go to the high-impedance state, so the signal lines must be fixed high with a pull-up resistor. transmit/receive clock: only an internal clock generated by the built-in baud rate generator can be used as the transmit/receive clock. the number of basic clock periods in a 1-bit transfer interval can be set to 32, 64, 372, or 256 with bits bcp1 and bcp0. for details, see section 13.3.5, clock. ers (fer) flag: as with the normal smart card interface, the ers flag indicates the error signal status, but since error signal transmission and reception is not performed, this flag is always cleared to 0. 13.4 usage notes the following points should be noted when using the sci as a smart card interface. receive data sampling timing and receive margin in smart card interface mode: in smart card interface mode, the sci operates on a base clock with a frequency of 32, 64, 372, or 256 times the transfer rate (determined by bits bcp1 and bcp0). in reception, the sci samples the falling edge of th e start bit using the base clock, and performs internal synchronization. receive data is latched internally at the rising edge of the 16th, 32nd, 186th, or 128th pulse of the base clock. use of a 372-times clock is illustrated in figure 13.10.
section 13 smart card interface rev.7.00 feb. 14, 2007 page 527 of 1108 rej09b0089-0700 internal base clock 372 clocks 1 8 6 clocks receive data (rxd) synchro- nization sampling timing d 0 d 1 data sampling timing 1 8 5 371 0 371 1 8 5 0 0 start bit figure 13.10 receive data samplin g timing in smart card mode (when using 372-times clock) thus the receive margin in asynchronous mode is given by the following formula. m = ? (0.5 ? 1 2n ) ? (l ? 0.5) f ? ? d ? 0.5 ? n (1 + f )? 100% where m: receive margin (%) n: ratio of bit rate to clock (n = 32, 64, 372, 256) d: clock duty (d = 0 to 1.0) l: frame length (l = 10) f: absolute value of clock frequency deviation assuming values of f = 0, d = 0.5, and n=372 in the above formula, the receive margin formula is as follows. when d = 0.5 and f = 0, m = (0.5 ? 1/2 372) 100% = 49.866%
section 13 smart card interface rev.7.00 feb. 14, 2007 page 528 of 1108 rej09b0089-0700 retransfer operations (except block transfer mode): retransfer operations are performed by the sci in receive mode and transmit mode as described below. ? retransfer operation when sci is in receive mode figure 13.11 illustrates the retransfer operation when the sci is in receive mode. [1] if an error is found when the received parity bit is checked, the per bit in ssr is automatically set to 1. if the rie bit in scr is enabled at this time, an eri interrupt request is generated. the per bit in ssr should be kept cleared to 0 until the next parity bit is sampled. [2] the rdrf bit in ssr is not set for a frame in which an error has occurred. [3] if no error is found when the received parity bit is checked, the per bit in ssr is not set. [4] if no error is found when the received parity bit is checked, the receive operation is judged to have been completed normally, and the rdrf flag in ssr is automatically set to 1. if the rie bit in scr is enabled at this time, an rxi interrupt request is generated. if dtc data transfer by an rxi source is enabled, the contents of rdr can be read automatically. when the rdr data is read by the dtc, the rdrf flag is automatically cleared to 0. [5] when a normal frame is received, the pin retains the high-impedance state at the timing for error signal transmission. d 0 d 1 d 2 d 3 d4 d 5 d 6 d 7 dp de ds d 0 d 1 d 2 d 3 d4 d 5 d 6 d 7 dp (de) ds d 0 d 1 d 2 d 3 d4 ds transfer frame n+ 1 retransferred frame nth transfer frame rdrf [ 1 ] per [ 2 ] [ 3 ] [4] figure 13.11 retransfer opera tion in sci receive mode
section 13 smart card interface rev.7.00 feb. 14, 2007 page 529 of 1108 rej09b0089-0700 ? retransfer operation when sci is in transmit mode figure 13.12 illustrates the retransfer operation when the sci is in transmit mode. [6] if an error signal is sent back from the receiving end after transmission of one frame is completed, the ers bit in ssr is set to 1. if th e rie bit in scr is enabled at this time, an eri interrupt request is generated. the ers bit in ssr should be kept cleared to 0 until the next parity bit is sampled. [7] the tend bit in ssr is not set for a frame for which an error signal indicating an abnormality is received. [8] if an error signal is not sent back from the receiving end, the ers bit in ssr is not set. [9] if an error signal is not sent back from the receiving end, transmission of one frame, including a retransfer, is judged to have been completed, and the tend bit in ssr is set to 1. if the tie bit in scr is enabled at this time, a txi interrupt request is generated. if dtc data transfer by a txi source is enabled, the next data can be written to tdr automatically. when data is written to tdr by the dtc, the tdre bit is automatically cleared to 0. d 0 d 1 d 2 d 3 d4 d 5 d 6 d 7 dp de ds d 0 d 1 d 2 d 3 d4 d 5 d 6 d 7 dp (de) ds d 0 d 1 d 2 d 3 d4 ds transfer frame n+ 1 retransferred frame nth transfer frame tdre tend [ 6 ] fer/ers transfer to tsr from tdr [ 7 ][9] [8] transfer to tsr from tdr transfer to tsr from tdr figure 13.12 retransfer operation in sci transmit mode
section 13 smart card interface rev.7.00 feb. 14, 2007 page 530 of 1108 rej09b0089-0700
section 14 a/d converter (8 analog input channel version) rev.7.00 feb. 14, 2007 page 531 of 1108 rej09b0089-0700 section 14 a/d converter (8 analog input channel version) 14.1 overview the chip incorporates a successive-approximations type 10-bit a/d converter that allows up to eight analog input channels to be selected. 14.1.1 features a/d converter features are listed below ? 10-bit resolution ? eight input channels ? settable analog conversion voltage range ? conversion of analog voltages with the reference voltage pin (v ref ) as the analog reference voltage ? high-speed conversion ? minimum conversion time: 6.7 s per channel (at 20-mhz operation) ? choice of single mode or scan mode ? single mode: single-channel a/d conversion ? scan mode: continuous a/d conversion on 1 to 4 channels ? four data registers ? conversion results are held in a 16-bit data register for each channel ? sample and hold function ? three kinds of conversion start ? choice of software or timer conversion start trigger (tpu or 8-bit timer), or adtrg pin ? a/d conversion end interrupt generation ? a/d conversion end interrupt (adi) request can be generated at the end of a/d conversion ? the data transfer controller (dtc) can be activated for data transfer by an interrupt ? module stop mode can be set ? as the initial setting, a/d converter operation is halted. register access is enabled by exiting module stop mode
section 14 a/d converter (8 analog input channel version) rev.7.00 feb. 14, 2007 page 532 of 1108 rej09b0089-0700 14.1.2 block diagram figure 14.1 shows a block diagram of the a/d converter. module data bus control circuit internal data bus 10-bit d/a converter comparator + ? sample-and- hold circuit adi interrupt signal bus interface a d c s r a d c r a d d r d a d d r c a d d r b a d d r a av cc v ref av ss an0 an1 an2 an3 an4 an5 an6 an7 adtrg conversion start trigger from 8-bit timer or tpu successive approximations register multiplexer adcr: adcsr: addra: addrb: addrc: addrd: legend: a/d control register a/d control/status register a/d data register a a/d data register b a/d data register c a/d data register d figure 14.1 block diagram of a/d converter
section 14 a/d converter (8 analog input channel version) rev.7.00 feb. 14, 2007 page 533 of 1108 rej09b0089-0700 14.1.3 pin configuration table 14.1 summarizes the input pins used by the a/d converter. the av cc and av ss pins are the power supply pins for the analog block in the a/d converter. the v ref pin is the a/d conversion reference voltage pin. the eight analog input pins are divided into two groups: group 0 (an0 to an3), and group 1 (an4 to an7). table 14.1 a/d converter pins pin name symbol i/o function analog power supply pin av cc input analog block power supply analog ground pin av ss input analog block ground and a/d conversion reference voltage reference voltage pin v ref input a/d conversion reference voltage analog input pin 0 an0 input group 0 analog inputs analog input pin 1 an1 input analog input pin 2 an2 input analog input pin 3 an3 input analog input pin 4 an4 input group 1 analog inputs analog input pin 5 an5 input analog input pin 6 an6 input analog input pin 7 an7 input a/d external trigger input pin adtrg input external trigger input for starting a/d conversion
section 14 a/d converter (8 analog input channel version) rev.7.00 feb. 14, 2007 page 534 of 1108 rej09b0089-0700 14.1.4 register configuration table 14.2 summarizes the registers of the a/d converter. table 14.2 a/d converter registers name abbreviation r/w initial value address * 1 a/d data register ah addrah r h'00 h'ff90 a/d data register al addral r h'00 h'ff91 a/d data register bh addrbh r h'00 h'ff92 a/d data register bl addrbl r h'00 h'ff93 a/d data register ch addrch r h'00 h'ff94 a/d data register cl addrcl r h'00 h'ff95 a/d data register dh addrdh r h'00 h'ff96 a/d data register dl addrdl r h'00 h'ff97 a/d control/status register adcsr r/(w) * 2 h'00 h'ff98 a/d control register adcr r/w h'3f h'ff99 module stop control register mstpcr r/w h'3fff h'ff3c notes: 1. lower 16 bits of the address. 2. bit 7 can only be written with 0 for flag clearing.
section 14 a/d converter (8 analog input channel version) rev.7.00 feb. 14, 2007 page 535 of 1108 rej09b0089-0700 14.2 register descriptions 14.2.1 a/d data registers a to d (addra to addrd) bit : 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 ? ? ? ? ? ? initial value : 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w : r r r r r r r r r r r r r r r r there are four 16-bit read-only addr registers, addra to addrd, used to store the results of a/d conversion. the 10-bit data resulting from a/d conversion is transferred to the addr register for the selected channel and stored there. the upper 8 bits of the converted data are transferred to the upper byte (bits 15 to 8) of addr, and the lower 2 bits are transferred to the lower byte (bits 7 and 6) and stored. bits 5 to 0 are always read as 0. the correspondence between the analog input channels and addr registers is shown in table 14.3. the addr registers can always be read by the cpu. the upper byte can be read directly, but for the lower byte, data transfer is performed via a temporary register (temp). for details, see section 14.3, interface to bus master. the addr registers are initialized to h'0000 by a reset, and in standby mode or module stop mode. table 14.3 analog input channels and corresponding addr registers analog input channel group 0 group 1 a/d data register an0 an4 addra an1 an5 addrb an2 an6 addrc an3 an7 addrd
section 14 a/d converter (8 analog input channel version) rev.7.00 feb. 14, 2007 page 536 of 1108 rej09b0089-0700 14.2.2 a/d control/status register (adcsr) bit : 7 6 5 4 3 2 1 0 adf adie adst scan cks ch2 ch1 ch0 initial value : 0 0 0 0 0 0 0 0 r/w : r/(w) * r/w r/w r/w r/w r/w r/w r/w note: * only 0 can be written to bit 7, to clear this flag. adcsr is an 8-bit readable/writable register that controls a/d conversion operations and shows the status of the operation. adcsr is initialized to h'00 by a reset, and in standby mode or module stop mode. bit 7?a/d end flag (adf): status flag that indicates the end of a/d conversion. bit 7 adf description 0 [clearing conditions] (initial value) ? when 0 is written to the adf flag after reading adf = 1 ? when the dtc is activated by an adi interrupt and addr is read 1 [setting conditions] ? single mode: when a/d conversion ends ? scan mode: when a/d conversion ends on all specified channels bit 6?a/d interrupt enable (adie): selects enabling or disabling of interrupt (adi) requests at the end of a/d conversion. bit 6 adie description 0 a/d conversion end interrupt (adi) request disabled (initial value) 1 a/d conversion end interrupt (adi) request enabled
section 14 a/d converter (8 analog input channel version) rev.7.00 feb. 14, 2007 page 537 of 1108 rej09b0089-0700 bit 5?a/d start (adst): selects starting or stopping of a/d conversion. holds a value of 1 during a/d conversion. the adst bit can be set to 1 by software, a timer conversion start trigger, or the a/d external trigger input pin ( adtrg ). bit 5 adst description 0 a/d conversion stopped (initial value) 1 ? single mode a/d conversion is started. cleared to 0 automatically when conversion on the specified channel ends ? scan mode a/d conversion is started. conversion continues sequentially on the selected channels until adst is cleared to 0 by software, a reset, or a transition to standby mode or module stop mode bit 4?scan mode (scan): selects single mode or scan mode as the a/d conversion operating mode. see section 14.4, operation, for details of single mode and scan mode operation. only set the scan bit while conversion is stopped (adst = 0). bit 4 scan description 0 single mode (initial value) 1 scan mode bit 3?clock select (cks): used together with the cks1 bit in adcr to set the a/d conversion time. only change the conversion time while conversion is stopped (adst = 0). adcr3 cks1 bit 3 cks description 0 0 conversion time = 530 states (max.) 1 conversion time = 68 states (max.) 1 0 conversion time = 266 states (max.) (initial value) 1 conversion time = 134 states (max.)
section 14 a/d converter (8 analog input channel version) rev.7.00 feb. 14, 2007 page 538 of 1108 rej09b0089-0700 bits 2 to 0?channel select 2 to 0 (ch2 to ch0): these bits are used together with the scan bit to select the analog input channels. only set the input channel(s) while conversion is stopped (adst = 0). group selection channel selection description ch2 ch1 ch0 single mode (scan = 0) scan mode (scan = 1) 0 0 0 an0 (initial value) an0 1 an1 an0, an1 1 0 an2 an0 to an2 1 an3 an0 to an3 1 0 0 an4 an4 1 an5 an4, an5 1 0 an6 an4 to an6 1 an7 an4 to an7 14.2.3 a/d control register (adcr) bit : 7 6 5 4 3 2 1 0 trgs1 trgs0 ? ? cks1 ? ? ? initial value : 0 0 1 1 1 1 1 1 r/w : r/w r/w ? ? r/w r/w ? ? adcr is an 8-bit readable/writable register that enables or disables external triggering of a/d conversion operations. adcr is initialized to h'3f by a reset, and in standby mode or module stop mode. bits 7 and 6?timer trigger select 1 and 0 (trgs1, trgs0): these bits select enabling or disabling of the start of a/d conversion by a trigger signal. only set bits trgs1 and trgs0 while conversion is stopped (adst = 0).
section 14 a/d converter (8 analog input channel version) rev.7.00 feb. 14, 2007 page 539 of 1108 rej09b0089-0700 bit 7 trgs1 bit 6 trgs0 description 0 0 a/d conversion start by external trigger is disabled (initial value) 1 a/d conversion start by external trigger (tpu) is enabled 1 0 a/d conversion start by external trigger (8-bit timer) is enabled 1 a/d conversion start by external trigger pin ( adtrg ) is enabled bits 5, 4, 1, and 0?reserved: these bits cannot be modified and are always read as 1. bit 3?clock select 1 (cks1): used together with the cks bit in adcsr to set the a/d conversion time. see the description of the cks bit for details. bit 2?reserved: a value of 1 must be written to this bit. 14.2.4 module stop control register (mstpcr) mstpcrh mstpcrl bit : 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value : 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w : r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w mstpcr is a 16-bit readable/writable register that performs module stop mode control. when the mstp9 bit in mstpcr is set to 1, a/d converter operation stops at the end of the bus cycle and a transition is made to module stop mode . registers cannot be read or written to in module stop mode. for details, see section 19.5, module stop mode. mstpcr is initialized to h'3fff by a reset and in ha rdware standby mode. it is not initialized in software standby mode. bit 9?module stop (mstp9): specifies the a/d converter module stop mode. bit 9 mstp9 description 0 a/d converter module stop mode cleared 1 a/d converter module stop mode set (initial value)
section 14 a/d converter (8 analog input channel version) rev.7.00 feb. 14, 2007 page 540 of 1108 rej09b0089-0700 14.3 interface to bus master addra to addrd are 16-bit registers, and the data bus to the bus master is 8 bits wide. therefore, in accesses by the bus master, the upper byte is accessed directly, but the lower byte is accessed via a temporary register (temp). a data read from addr is performed as follows. when the upper byte is read, the upper byte value is transferred to the cpu and the lower byte value is transferred to temp. next, when the lower byte is read, the temp contents are transferred to the cpu. when reading addr, always read the upper byte befo re the lower byte. it is possible to read only the upper byte, but if only the lower byte is read, incorrect data may be obtained. figure 14.2 shows the data flow for addr access. bus master (h'aa) addrnh (h'aa) addrnl (h'40) lower byte read addrnh (h'aa) addrnl (h'40) temp (h'40) temp (h'40) (n = a to d) (n = a to d) module data bus module data bus bus interface upper byte read bus master (h'40) bus interface figure 14.2 addr access opera tion (reading h'aa40)
section 14 a/d converter (8 analog input channel version) rev.7.00 feb. 14, 2007 page 541 of 1108 rej09b0089-0700 14.4 operation the a/d converter operates by successive approximations with 10-bit resolution. it has two operating modes: single mode and scan mode. 14.4.1 single mode (scan = 0) single mode is selected when a/d conversion is to be performed on a single channel only. a/d conversion is started when the adst bit is set to 1 by software or by external trigger input. the adst bit remains set to 1 during a/d conversion, and is automatically cleared to 0 when conversion ends. on completion of conversion, the adf flag is set to 1. if the adie bit is set to 1 at this time, an adi interrupt request is generated. the adf flag is cleared by writing 0 to it after reading adcsr. when the operating mode or analog input channel must be changed during analog conversion, to prevent incorrect operation, first clear the adst bit to 0 in adcsr to halt a/d conversion. after making the necessary changes, set the adst bit to 1 to start a/d conversion again. the adst bit can be set at the same time as the operating mode or input channel is changed. typical operations when channel 1 (an1) is selected in single mode are described next. figure 14.3 shows a timing diagram for this example. [1] single mode is selected (scan = 0), input channel an1 is selected (ch2 = 0, ch1 = 0, ch0 = 1), the a/d interrupt is enabled (adie = 1), and a/d conversion is started (adst = 1). [2] when a/d conversion is completed, the result is transferred to addrb. at the same time the adf flag is set to 1, the adst bit is clear ed to 0, and the a/d converter becomes idle. [3] since adf = 1 and adie = 1, an adi interrupt is requested. [4] the a/d interrupt handling routine starts. [5] the routine reads adcsr, then writes 0 to the adf flag. [6] the routine reads and processes the conversion result (addrb). [7] execution of the a/d interrupt handling routine ends. after that, if the adst bit is set to 1, a/d conversion starts again and steps [2] to [7] are repeated.
section 14 a/d converter (8 analog input channel version) rev.7.00 feb. 14, 2007 page 542 of 1108 rej09b0089-0700 adie adst adf state of channel 0 (an0) a/d conversion starts 2 1 addra addrb addrc addrd state of channel 1 (an1) state of channel 2 (an2) state of channel 3 (an3) note: * vertical arrows ( ) indicate instructions executed by software. set * set * clear * clear * a/d conversion result 1 a/d conversion a/d conversion result 2 read conversion result read conversion result idle idle idle idle idle idle a/d conversion set * figure 14.3 example of a/d converter opera tion (single mode, channel 1 selected)
section 14 a/d converter (8 analog input channel version) rev.7.00 feb. 14, 2007 page 543 of 1108 rej09b0089-0700 14.4.2 scan mode (scan = 1) scan mode is useful for monitoring analog inputs in a group of one or more channels. when the adst bit is set to 1 by software, or by timer or external trigger input, a/d conversion starts on the first channel in the group (an0). when two or more channels are selected, after conversion of the first channel ends, conversion of the second channel (an1) starts immediately. a/d conversion continues cyclically on the selected channels un til the adst bit is cleared to 0. the conversion results are transferred for storage into the addr registers corresponding to the channels. when the operating mode or analog input channel must be changed during analog conversion, to prevent incorrect operation, first clear the adst bit to 0 in adcsr to halt a/d conversion. after making the necessary changes, set the adst bit to 1 to start a/d conversion again. the adst bit can be set at the same time as the operating mode or input channel is changed. typical operations when three channels (an0 to an2) are selected in scan mode are described next. figure 14.4 shows a timing diagram for this example. [1] scan mode is selected (scan = 1), scan group 0 is selected (ch2 = 0), analog input channels an0 to an2 are selected (ch1 = 1, ch0 = 0), and a/d conversion is started (adst = 1) [2] when a/d conversion of the first channel (an0) is completed, the result is transferred to addra. next, conversion of the second channel (an1) starts automatically. [3] conversion proceeds in the same way through the third channel (an2). [4] when conversion of all the selected channels (an0 to an2) is completed, the adf flag is set to 1 and conversion of the first channel (an0) starts again. if the adie bit is set to 1 at this time, an adi interrupt is requested after a/d conversion ends. [5] steps [2] to [4] are repeated as long as the adst bit remains set to 1. when the adst bit is cleared to 0, a/d conversion stops. after that, if the adst bit is set to 1, a/d conversion starts again from the first channel (an0).
section 14 a/d converter (8 analog input channel version) rev.7.00 feb. 14, 2007 page 544 of 1108 rej09b0089-0700 adst adf addra addrb addrc addrd state of channel 0 (an0) state of channel 1 (an1) state of channel 2 (an2) state of channel 3 (an3) set * 1 clear * 1 idle notes: 1. vertical arrows ( ) indicate instructions executed by software. 2. data currently being converted is ignored. clear * 1 idle idle a/d conversion time idle continuous a/d conversion a/d conversion 1 idle idle idle idle idle transfer * 2 a/d conversion 3 a/d conversion 2 a/d conversion 5 a/d conversion 4 a/d conversion result 1 a/d conversion result 2 a/d conversion result 3 a/d conversion result 4 figure 14.4 example of a/d converter operation (scan mode, channels an0 to an2 selected)
section 14 a/d converter (8 analog input channel version) rev.7.00 feb. 14, 2007 page 545 of 1108 rej09b0089-0700 14.4.3 input sampling and a/d conversion time the a/d converter has a built-in sample-and-hold circuit. the a/d converter samples the analog input at a time t d after the adst bit is set to 1, then starts conversion. figure 14.5 shows the a/d conversion timing. table 14.4 indicates the a/d conversion time. as indicated in figure 14.5, the a/d conversion time includes t d and the input sampling time. the length of t d varies depending on the timing of the write access to adcsr. the total conversion time therefore varies within the ranges indicated in table 14.4. in scan mode, the values given in table 14.4 apply to the first conversion time. in the second and subsequent conversions the conversion time is as shown in table 14.5. (1) (2) t d t s pl t c on v i n p ut sa mpli n g t imi n g a d f address bus write signal l e g end : (1) : adcsr wr i te cyc l e (2) : adcsr address t d : a / d convers i on start de l ay t s pl : i n p ut sa mpli n g t im e t c on v : a / d convers i on t im e figure 14.5 a/d conversion timing
section 14 a/d converter (8 analog input channel version) rev.7.00 feb. 14, 2007 page 546 of 1108 rej09b0089-0700 table 14.4 a/d conversion time (single mode) cks1 = 0 cks1 = 1 cks = 0 cks = 1 cks = 0 cks = 1 item symbol min typ max min typ max min typ max min typ max a/d conversion start delay t d 18 ? 33 4 ? 5 10 ? 17 6 ? 9 input sampling time t spl ? 127 ? ? 15 ? ? 63 ? ? 31 ? a/d conversion time t conv 515 ? 530 67 ? 68 259 ? 266 131 ? 134 note: values in the table are the number of states. table 14.5 a/d conversion time (scan mode) cks1 cks conversion time (states) 0 0 512 (fixed) 1 64 (fixed) 1 0 256 (fixed) 1 128 (fixed) 14.4.4 external trigger input timing a/d conversion can be externally triggered. wh en the trgs1 and trgs0 bits are set to b'11 in adcr, external trigger input is enabled at the adtrg pin. a falling edge at the adtrg pin sets the adst bit to 1 in adcsr, starting a/d conversion. other operations, in both single and scan modes, are the same as when the adst bit has been set to 1 by software. figure 14.6 shows the timing.
section 14 a/d converter (8 analog input channel version) rev.7.00 feb. 14, 2007 page 547 of 1108 rej09b0089-0700 adtrg internal tri gg er si g nal a dst a/d conversion figure 14.6 external trigger input timing 14.5 interrupts the a/d converter generates an a/d conversion end interrupt (adi) at the end of a/d conversion. adi interrupt requests can be enabled or disabled by means of the adie bit in adcsr. the dtc can be activated by an adi interrupt. having the converted data read by the dtc in response to an adi interrupt enables continuous conversion to be achieved without imposing a load on software. the a/d converter interrupt source is shown in table 14.6. table 14.6 a/d converter interrupt source interrupt source description dtc activation adi interrupt due to end of conversion possible
section 14 a/d converter (8 analog input channel version) rev.7.00 feb. 14, 2007 page 548 of 1108 rej09b0089-0700 14.6 usage notes the following points should be noted when using the a/d converter. setting range of analog power supply and other pins 1. analog input voltage range the voltage applied to analog input pins ann during a/d conversion should be in the range av ss ann v ref . 2. relation between av cc , av ss and v cc , v ss as the relationship between av cc , av ss and v cc , v ss , set av ss = v ss . if the a/d converter is not used, the av cc and av ss pins must not be left open. 3. v ref input range the analog reference voltage input at the v ref pin should be set in the range v ref av cc . the v ref pin should be set as v ref = v cc when the a/d converter is not used. do not leave the v ref pin open. if conditions 1, 2, and 3 above are not met, the reliability of the device may be adversely affected. notes on board design: in board design, digital circuitry and analog circuitry should be as mutually isolated as possible, and layout in whic h digital circuit signal lines and analog circuit signal lines cross or are in close proximity should be avoided as far as possible. failure to do so may result in incorrect operation of the analog circuitry due to inductance, adversely affecting a/d conversion values. also, digital circuitry must be isolated from the analog input signals (an0 to an7), analog reference power supply (v ref ), and analog power supply (av cc ) by the analog ground (av ss ). also, the analog ground (av ss ) should be connected at one point to a stable digital ground (v ss ) on the board. notes on noise countermeasures: a protection circuit connected to prevent damage due to an abnormal voltage such as an excessive surge at the analog input pins (an0 to an7) and analog reference power supply (v ref ) should be connected between av cc and av ss as shown in figure 14.7. also, the bypass capacitors connected to av cc and v ref and the filter capacitor connected to an0 to an7 must be connected to av ss . if a filter capacitor is connected as shown in figure 14.7, the input currents at the analog input pins (an0 to an7) are averaged, and so an error may arise. also, when a/d conversion is performed
section 14 a/d converter (8 analog input channel version) rev.7.00 feb. 14, 2007 page 549 of 1108 rej09b0089-0700 frequently, as in scan mode, if the current charged and discharged by the capacitance of the sample-and-hold circuit in the a/d converter exceeds the current input via the input impedance (r in ), an error will arise in the analog input pi n voltage. careful consideration is therefore required when deciding the circuit constants. av cc * 1 * 1 v ref an0 to an7 av ss notes: values are reference values. 1. 2 . r in : input impedance r in * 2 100 0.1 f 0.01 f 10 f figure 14.7 example of analog input protection circuit
section 14 a/d converter (8 analog input channel version) rev.7.00 feb. 14, 2007 page 550 of 1108 rej09b0089-0700 a/d conversion precision definitions: the chip?s a/d conversion precision definitions are given below. ? resolution the number of a/d converter digital output codes. ? offset error the deviation of the analog input voltage valu e from the ideal a/d conversion characteristic when the digital output changes from the minimum voltage value b'0000000000 to b'0000000001 (see figure 14.9). ? full-scale error the deviation of the analog input voltage valu e from the ideal a/d conversion characteristic when the digital output changes from b'1111111110 to b'1111111111 (see figure 14.9). ? quantization error the deviation inherent in the a/d converter, given by 1/2 lsb (see figure 14.8). ? nonlinearity error the error with respect to the ideal a/d conversion characteristic between the zero voltage and the full-scale voltage. does not include the offset error, full-scale error, or quantization error. ? absolute precision the deviation between the digital value and the analog input value. includes the offset error, full-scale error, quantization error, and nonlinearity error.
section 14 a/d converter (8 analog input channel version) rev.7.00 feb. 14, 2007 page 551 of 1108 rej09b0089-0700 111 110 101 100 011 010 001 000 fs quantization error digital output ideal a/d conversion characteristic analog input voltage 1 1024 2 1024 1022 1024 1023 1024 figure 14.8 a/d conversion precision definitions (1) fs offset error nonlinearity error actual a/d conversion characteristic analog input voltage digital output ideal a/d conversion characteristic full-scale error figure 14.9 a/d conversion precision definitions (2)
section 14 a/d converter (8 analog input channel version) rev.7.00 feb. 14, 2007 page 552 of 1108 rej09b0089-0700 permissible signal source impedance: the chip?s analog input is designed so that conversion precision is guaranteed for an input signal for which the signal source impedance is 5 k or less. this specification is provided to enable the a/d converter's sample-and-hold circuit input capacitance to be charged within the sampling time; if the sensor output impedance exceeds 5 k , charging may be insufficient and it may not be possible to guarantee the a/d conversion precision. if a large capacitance is provided externally, the input load will essentially comprise only the internal input resistance of 10 k , and the signal source impedance is ignored. however, since a low-pass filter effect is obtained in this case, it may not be possible to follow an analog signal with a large differential coefficient (e.g., 5 mv/ s or greater). when converting a high-speed analog signal, a low-impedance buffer should be inserted. influences on absolute precision: adding capacitance results in coupling with gnd, and therefore noise in gnd may adversely affect absolu te precision. be sure to make the connection to an electrically stable gnd such as av ss . care is also required to insure that filter circuits do not communicate with digital signals on the mounting board, so acting as antennas. a/d converter equivalent circuit chip 20 pf c in = 15 pf 10 k low-pass filter c to 0.1 f sensor output impedance max. 5 k sensor input note: values are reference values. figure 14.10 example of analog input circuit
section 15 d/a converter rev.7.00 feb. 14, 2007 page 553 of 1108 rej09b0089-0700 section 15 d/a converter 15.1 overview the chip includes an 8-bit resolution d/a converter with two analog signal output channels. 15.1.1 features d/a converter features are listed below. ? 8-bit resolution ? two output channels ? maximum conversion time of 10 s (with 20-pf load) ? output voltage of 0 v to v ref ? d/a output hold function in software standby mode ? module stop mode can be set ? as the initial setting, d/a converter operation is halted. register access is enabled by exiting module stop mode.
section 15 d/a converter rev.7.00 feb. 14, 2007 page 554 of 1108 rej09b0089-0700 15.1.2 block diagram figure 15.1 shows a block diagram of the d/a converter. module data bus internal data bus v ref av cc da1 da0 av ss 8-bit d/a converter control circuit dadr0 bus interface dadr1 dacr legend: dacr: d/a control register dadr0, dadr1: d/a data registers 0, 1 figure 15.1 block diagram of d/a converter
section 15 d/a converter rev.7.00 feb. 14, 2007 page 555 of 1108 rej09b0089-0700 15.1.3 pin configuration table 15.1 summarizes the input and output pins of the d/a converter. table 15.1 pin configuration pin name symbol i/o function analog power pin av cc input analog power source analog ground pin av ss input analog ground and reference voltage analog output pin 0 da0 output channel 0 analog output analog output pin 1 da1 output channel 1 analog output reference voltage pin v ref input analog reference voltage 15.1.4 register configuration table 15.2 summarizes the registers of the d/a converter. table 15.2 d/a converter registers channels name abbreviation r/w initial value address * 0, 1 d/a data register 0 dadr0 r/w h'00 h'ffa4 d/a data register 1 dadr1 r/w h'00 h'ffa5 d/a control register dacr01 r/w h'1f h'ffa6 common module stop control register mstpcr r/w h'3fff h'ff3c note: * lower 16 bits of the address.
section 15 d/a converter rev.7.00 feb. 14, 2007 page 556 of 1108 rej09b0089-0700 15.2 register descriptions 15.2.1 d/a data registers 0, 1 (dadr0, dadr1) bit : 7 6 5 4 3 2 1 0 initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w dadr0, dadr1 are 8-bit readable/writable registers that store data for conversion. whenever output is enabled, the values in dadr0 and dadr1 are converted and output from the analog output pins. dadr0 and dadr1 are each initialized to h'00 by a reset and in hardware standby mode. 15.2.2 d/a control registers 01 (dacr01) bit : 7 6 5 4 3 2 1 0 daoe1 daoe0 dae ? ? ? ? ? initial value : 0 0 0 1 1 1 1 1 r/w : r/w r/w r/w ? ? ? ? ? dacr01 is 8-bit readable/writable register that controls the operation of the d/a converter. dacr01 is initialized to h'1f by a reset and in hardware standby mode. bit 7?d/a output enable 1 (daoe1): controls d/a conversion and analog output. bit 7 daoe1 description 0 analog output da1 is disabled (initial value) 1 channel 1 d/a conversion is enabled; analog output da1 is enabled
section 15 d/a converter rev.7.00 feb. 14, 2007 page 557 of 1108 rej09b0089-0700 bit 6?d/a output enable 0 (daoe0): controls d/a conversion and analog output. bit 6 daoe0 description 0 analog output da0 is disabled (initial value) 1 channel 0 d/a conversion is enabled; analog output da0 is enabled bit 5?d/a enable (dae): used together with the daoe0 and daoe1 bits to control d/a conversion. when the dae bit is cleared to 0, channel 0 and 1 d/a conversions are controlled independently. when the dae bit is set to 1, channel 0 and 1 d/a conversions are controlled together. output of conversion results is always controlled independently by the daoe0 and daoe1 bits. bit 7 daoe1 bit 6 daoe0 bit 5 dae description 0 0 channel 0 and 1 d/a conversions disabled 1 0 channel 0 d/a conversion enabled channel 1 d/a conversion disabled 1 channel 0 and 1 d/a conversions enabled 1 0 0 channel 0 d/a conversion disabled channel 1 d/a conversion enabled 1 channel 0 and 1 d/a conversions enabled 1 channel 0 and 1 d/a conversions enabled : don?t care if the chip enters software standby mode when d/a conversion is enabled, the d/a output is held and the analog power current is the same as during d/a conversion. when it is necessary to reduce the analog power current in software standby mode, clear both the daoe0 and daoe1 bits to 0 to disable d/a output. bits 4 to 0?reserved: these bits cannot be modified and are always read as 1.
section 15 d/a converter rev.7.00 feb. 14, 2007 page 558 of 1108 rej09b0089-0700 15.2.3 module stop control register (mstpcr) mstpcrh mstpcrl bit : 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value : 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w : r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w mstpcr is a 16-bit readable/writable register that performs module stop mode control. when the mstp10 bit in mstpcr is set to 1, d/a converter operation stops at the end of the bus cycle and a transition is made to module stop mode . registers cannot be read or written to in module stop mode. for details, see section 19.5, module stop mode. mstpcr is initialized to h'3fff by a reset and in ha rdware standby mode. it is not initialized in software standby mode. bit 10?module stop (mstp10): specifies the d/a converter (channels 0, 1) module stop mode. bit 10 mstp10 description 0 d/a converter (channels 0, 1) module stop mode cleared 1 d/a converter (channels 0, 1) module stop mode set (initial value)
section 15 d/a converter rev.7.00 feb. 14, 2007 page 559 of 1108 rej09b0089-0700 15.3 operation the d/a converter includes d/a conversion circuits for two channels, each of which can operate independently. d/a conversion is performed continuously while enabled by dacr. if either dadr0 or dadr1 is written to, the new data is immediately converted. the conversion result is output by setting the corresponding daoe0 or daoe1 bit to 1. the operation example described in this section concerns d/a conversion on channel 0. figure 15.2 shows the timing of this operation. [1] write the conversion data to dadr0. [2] set the daoe0 bit in dacr01 to 1. d/a conversion is started and the da0 pin becomes an output pin. the conversion result is output after the conversion time has elapsed. the output value is expressed by the following formula: dadr contents 256 v re f the conversion results are output continuously until dadr0 is written to again or the daoe0 bit is cleared to 0. [3] if dadr0 is written to again, the new data is immediately converted. the new conversion result is output after the conversion time has elapsed. [4] if the daoe0 bit is cleared to 0, the da0 pin becomes an input pin.
section 15 d/a converter rev.7.00 feb. 14, 2007 page 560 of 1108 rej09b0089-0700 conversion data 1 conversion result 1 high-impedance state t dconv dadr0 write cycle da0 daoe0 dadr0 address dacr01 write cycle conversion data 2 conversion result 2 t dconv legend: t dconv : d/a conversion time dadr0 write cycle dacr01 write cycle figure 15.2 example of d/a converter operation
section 16 ram rev.7.00 feb. 14, 2007 page 561 of 1108 rej09b0089-0700 section 16 ram 16.1 overview the chip has on-chip high-speed static ram. th e ram is connected to the cpu by a 16-bit data bus, enabling one-state access by the cpu to both byte data and word data. this makes it possible to perform fast word data transfer. the on-chip ram can be enabled or disabled by means of the ram enable bit (rame) in the system control register (syscr). note: the amount of on-chip ram is 16 kbytes in the h8s/2319c, 8 kbytes in the h8s/2319, h8s/2318, h8s/2317, h8s/2317s, h8s/2316s, h8s/2315, and h8s/2312s, 4 kbytes in the h8s/2314. 16.1.1 block diagram figure 16.1 shows a block diagram of 8 kbytes of on-chip ram. internal data bus (upper 8 bits) internal data bus (lower 8 bits) h'ffdc00 h'ffdc02 h'ffdc04 h'fffbfe h'ffdc01 h'ffdc03 h'ffdc05 h'fffbff figure 16.1 block diagram of ram (8 kbytes)
section 16 ram rev.7.00 feb. 14, 2007 page 562 of 1108 rej09b0089-0700 16.1.2 register configuration the on-chip ram is controlled by syscr. table 16.1 shows the address and initial value of syscr. table 16.1 ram register name abbreviation r/w initial value address * system control register syscr r/w h'01 h'ff39 note: * lower 16 bits of the address. 16.2 register descriptions 16.2.1 system control register (syscr) bit : 7 6 5 4 3 2 1 0 ? ? intm1 intm0 nmieg lwrod ? rame initial value : 0 0 0 0 0 0 0 1 r/w : r/w ? r/w r/w r/w r/w r/w r/w the on-chip ram is enabled or disabled by the rame bit in syscr. for details of other bits in syscr, see section 5.2.1, system control register (syscr). bit 0?ram enable (rame): enables or disables the on-chip ram. the rame bit is initialized when the reset state is released. it is not initialized in software standby mode. bit 0 rame description 0 on-chip ram is disabled 1 on-chip ram is enabled (initial value)
section 16 ram rev.7.00 feb. 14, 2007 page 563 of 1108 rej09b0089-0700 16.3 operation when the rame bit is set to 1, acce sses to addresses h'ffdc00 to h'fffbff * are directed to the on-chip ram. when the rame bit is cleared to 0, the off-chip address space is accessed. since the on-chip ram is connected to the cpu by an internal 16-bit data bus, it can be written to and read in byte or word units. each type of access can be performed in one state. even addresses use the upper 8 bits, and odd addresses use the lower 8 bits. word data must start at an even address. note: * the amount of on-chip ram is 16 kbytes in the h8s/2319c, 8 kbytes in the h8s/2319, h8s/2318, h8s/2317, h8s/2317s, h8s/2316s, h8s/2315, and h8s/2312s, 4 kbytes in the h8s/2314. 16.4 usage note dtc register information can be located in a ddresses h'fff800 to h'fffbff. when the dtc is used, the rame bit must not be cleared to 0.
section 16 ram rev.7.00 feb. 14, 2007 page 564 of 1108 rej09b0089-0700
section 17 rom rev.7.00 feb. 14, 2007 page 565 of 1108 rej09b0089-0700 section 17 rom 17.1 overview this lsi has 512, 384, 256, or 128 kbytes of on-chip flash memory, or 512, 384, 256, 128, or 64 kbytes of on-chip mask rom. the rom is connected to the bus master via a 16-bit data bus, enabling both byte and word data to be accessed in one state. instruction fetching is thus speeded up, and processing speed increased. the on-chip rom is enabled and disabled by means of the mode pins (md2 to md0) and the eae bit in bcrl. the flash memory version of the chip can be erased and programmed with a prom programmer, as well as on-board. 17.1.1 block diagram figure 17.1 shows a block diagram of 512 kbytes of on-chip rom. internal data bus (upper 8 bits) internal data bus (lower 8 bits) h'000000 h'000002 h'07fffe h'000001 h'000003 h'07ffff figure 17.1 block diagram of rom (512 kbytes)
section 17 rom rev.7.00 feb. 14, 2007 page 566 of 1108 rej09b0089-0700 17.1.2 register configuration the operating mode of the chip is controlled by the mode pins and the bcrl register. the rom- related registers are shown in table 17.1. table 17.1 rom registers register name abbreviation r/w initial value address * mode control register mdcr r/w undefined h'ff3b bus controller register bcrl r/w undefined h'fed5 note: * lower 16 bits of the address. 17.2 register descriptions 17.2.1 mode control register (mdcr) bit : 7 6 5 4 3 2 1 0 ? ? ? ? ? mds2 mds1 mds0 initial value : 1 0 0 0 0 ? * ? * ? * r/w : ? ? ? ? ? r r r note: * determined by pins md2 to md0. mdcr is an 8-bit read-only register used to monitor the current operating mode of the chip. bit 7?reserved: this bit cannot be modified and is always read as 1. bits 6 to 3?reserved: these bits cannot be modified and are always read as 0. bits 2 to 0?mode select 2 to 0 (mds2 to mds0): these bits indicate the input levels at pins md2 to md0 (the current operating mode). bits mds2 to mds0 correspond to pins md2 to md0. mds2 to mds0 are read-only bits, and cannot be modified. the mode pin (md2 to md0) input levels are latched into these bits when md cr is read. these latches are canceled by a reset.
section 17 rom rev.7.00 feb. 14, 2007 page 567 of 1108 rej09b0089-0700 17.2.2 bus control register l (bcrl) bit : 7 6 5 4 3 2 1 0 brle breqoe eae ? ? ? ? waite initial value : 0 0 1 1 1 1 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w enabling or disabling of part of the on-chip rom ar ea in the chip can be selected by means of the eae bit in bcrl. for details of the other bits in bcrl, see section 6.2.5, bus control register l (bcrl). bit 5?external address enable (eae): selects whether addr esses h'010000 to h'03ffff * 2 are to be internal addresses or external addresses. description bit 5 eae h8s/2319, h8s/2319c, h8s/2318, h8s/2315, h8s/2314 h8s/2317(s) * 3 h8s/2316s 0 on-chip rom addresses h'010000 to h'01ffff are in on-chip rom and addresses h'020000 to h'03ffff are a reserved area * 1 reserved area * 1 1 addresses h'010000 to h'03ffff * 2 are external addresses (in external expanded mode) or a reserved area * 1 (in single-chip mode) (initial value) notes: 1. the reserved area must not be accessed. 2. h'010000 to h'03ffff in the h8s/2318. h'010000 to h'05ffff in the h8s/2315 and h8s/2314. h'010000 to h'07ffff in the h8s/2319 and h8s/2319c. 3. h8s/2317s in mask rom version. 17.3 operation the on-chip rom is connected to the cpu by a 16-bit data bus, and both byte and word data can be accessed in one state. even addresses are conn ected to the upper 8 bits, and odd addresses to the lower 8 bits. word data must start at an even address. the on-chip rom is enabled and disabled by setting the mode pins (md2 to md0) and the eae bit in bcrl. these settings are shown in table 17.2 and table 17.3.
section 17 rom rev.7.00 feb. 14, 2007 page 568 of 1108 rej09b0089-0700 table 17.2 operating modes and rom (h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, h8s/2314 f-ztat) mode pins bcrl mode operating mode fwe md 2 md1 md0 eae on-chip rom 1 ? 0 0 0 1 ? ? 2 1 0 3 1 4 advanced expanded mode with on-chip rom disabled 1 0 0 ? disabled 5 advanced expanded mode with on-chip rom disabled 1 6 advanced expanded mode with on-chip rom enabled 1 0 0 enabled (256 kbytes) * 1 * 5 1 enabled (64 kbytes) 7 advanced single-chip mode 1 0 enabled (256 kbytes) * 1 * 5 1 enabled (64 kbytes) 8 ? 1 0 0 0 ? ? 9 1 10 1 0 0 enabled (256 kbytes) * 2 * 5 boot mode (advanced expanded mode with on-chip rom enabled) * 3 1 enabled (64 kbytes) 11 boot mode (advanced single-chip mode) * 4 1 0 enabled (256 kbytes) * 2 * 5 1 enabled (64 kbytes) 12 ? 1 0 0 ? ? 13 1 14 1 0 0 enabled (256 kbytes) * 1 * 5 user program mode (advanced expanded mode with on-chip rom enabled) * 3 1 enabled (64 kbytes) 15 1 0 enabled (256 kbytes) * 1 * 5 user program mode (advanced single-chip mode) * 4 1 enabled (64 kbytes)
section 17 rom rev.7.00 feb. 14, 2007 page 569 of 1108 rej09b0089-0700 notes: 1. note that in modes 6, 7, 14, and 15, the on-chip rom that can be used after a reset is the 64-kbyte area from h'000000 to h'00ffff. 2. note that in the mode 10 and mode 11 boot modes, the on-chip rom that can be used immediately after all flash memory is erased by the boot program is the 64-kbyte area from h'000000 to h'00ffff. 3. apart from the fact that flash memory can be erased and programmed, operation is the same as in advanced expanded mode with on-chip rom enabled. 4. apart from the fact that flash memory can be erased and programmed, operation is the same as in advanced single-chip mode. 5. the capacity of on-chip rom in the h8s/2318 f-ztat is 256 kbytes. the capacity of on-chip rom in the h8s/2317 f-ztat is 128 kbytes. the capacity of on-chip rom in the h8s/2315 f-ztat and h8s/2314 f-ztat is 384 kbytes.
section 17 rom rev.7.00 feb. 14, 2007 page 570 of 1108 rej09b0089-0700 table 17.3 operating modes and rom (h8s/2319 f-ztat, h8s/2319c f-ztat, and mask rom version) mode pins bcrl mode operating mode md2 md1 md0 eae on-chip rom 1 * 3 ? 0 0 1 ? ? 2 * 2 1 0 3 * 2 1 4 advanced expanded mode with on-chip rom disabled 1 0 0 ? disabled 5 advanced expanded mode with on-chip rom disabled 1 6 1 0 0 enabled (256 kbytes) * 1 advanced expanded mode with on-chip rom enabled 1 enabled (64 kbytes) 7 advanced single-chip mode 1 0 enabled (256 kbytes) * 1 1 enabled (64 kbytes) notes: 1. note that in modes 6 and 7, the on-chip rom that can be used after a reset is the 64- kbyte area from h'000000 to h'00ffff. the h8s/2319 and h8s/2319c have 512 kbytes of on-chip rom. the h8s/2318 has 256 kbytes of on-chip rom. the h8s/2317 and h8s/2317s have 128 kbytes of on-chip rom. the h8s/2316s has 64 kbytes of on-chip rom. 2. boot mode in the h8s/2319 f-ztat and h8s/2319c f-ztat. for boot mode in the h8s/2319 f-ztat, see table 17.30. also see table 17.30, for information on user program mode. for boot mode in the h8s/2319c f-ztat, see table 17.52. also see table 17.52, for information on user program mode. 3. user boot mode in the h8s/2319c f-ztat. for user boot mode in the h8s/2319c f-ztat, see table 17.52.
section 17 rom rev.7.00 feb. 14, 2007 page 571 of 1108 rej09b0089-0700 17.4 overview of flash memory (h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, h8s/2314 f-ztat) 17.4.1 features the h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat have 384, 256, 128 kbytes of on-chip flash memory. the features of the flash memory are summarized below. ? four flash memory operating modes ? program mode ? erase mode ? program-verify mode ? erase-verify mode ? programming/erase methods the flash memory is programmed 128 bytes at a time. erasing is performed by block erase (in single-block units). to erase the entire flash memory, the individual blocks must be erased sequentially. block erasing can be performed as required on 4-kbyte, 32-kbyte, and 64-kbyte blocks. ? programming/erase times the flash memory programming time is 10.0 ms (typ.) for simultaneous 128-byte programming, equivalent to 78 s (typ.) per byte, and the erase time is 50 ms (typ.). ? reprogramming capability the flash memory can be reprogrammed a minimum of 100 times. ? on-board programming modes there are two modes in which flash memory can be programmed/erased/verified on-board: ? boot mode ? user program mode ? automatic bit rate adjustment with data transfer in boot mode, the bit rate of the chip can be automatically adjusted to match the transfer bit rate of the host. ? flash memory emulation by ram * part of the ram area can be overlapped onto flash memory, to emulate flash memory updates in real time. ? protect modes there are three protect modes, hardware, soft ware, and error protect, which allow protected status to be designated for flash memory program/erase/verify operations.
section 17 rom rev.7.00 feb. 14, 2007 page 572 of 1108 rej09b0089-0700 ? programmer mode flash memory can be programmed/erased in programmer mode, using a prom programmer, as well as in on-board programming mode. note: * flash memory emulation by ram is not supported in the h8s/2314 f-ztat. 17.4.2 overview block diagram m odu l e bus b us i nter f a c e /c ontro ll er fl as h m e m or y (128 , 2 56, 38 4 k b y tes) o perat i n g m ode ebr 1 i nterna l address bus i nterna l data bus (1 6 b i ts) fwe p i n m ode p i ns ebr 2 syscr 2 flmcr 2 flmcr 1 ramer l e g end : flmcr 1 : fl as h m e m or y c ontro l re gi ster 1 flmcr 2 : fl as h m e m or y c ontro l re gi ster 2 ebr 1 : e rase b l o ck re gi ster 1 ebr 2 : e rase b l o ck re gi ster 2 ramer: ram e m u l at i on re gi ster syscr 2 : sy ste m c ontro l re gi ster 2 figure 17.2 block diagram of flash memory
section 17 rom rev.7.00 feb. 14, 2007 page 573 of 1108 rej09b0089-0700 17.4.3 flash memory operating modes mode transitions: when the mode pins and the fwe pin are set in the reset state and a reset- start is executed, the chip enters one of the operating modes shown in figure 17.3. in user mode, flash memory can be read but not programmed or erased. flash memory can be programmed and erased in boot mode, user program mode, and programmer mode. b oot m ode o n - board pro g ra mmi n g m ode u ser pro g ra m m ode u ser m ode (on -chi p rom enab l ed) r eset state p ro g ra mm er m ode res = 0 fwe = 1 , swe = 1 fwe = 0 or swe = 0 * n otes : o n ly m a k e a trans i t i on between user m ode and user pro g ra m m ode w h en t h e cpu i s not a cc ess i n g t h e fl as h m e m or y. * md 2 = md 1 = md 0 = 0 , pf 2 = 1 , pf 1 = pf 0 = 0 res = 0 res = 0 res = 0 md 1 = 1 , md 2 = 1 , fwe = 0 fwe = 1 , md 1 = 1 , md 2 = 0 figure 17.3 flash memory mode transitions
section 17 rom rev.7.00 feb. 14, 2007 page 574 of 1108 rej09b0089-0700 17.4.4 on-board programming modes ? boot mode fl as h m e m or y chi p ram h ost p ro g ra mmi n g c ontro l pro g ra m sci a pp lic at i on pro g ra m (o l d v ers i on) n ew app lic at i on pro g ra m fl as h m e m or y chi p ram h ost sci a pp lic at i on pro g ra m (o l d v ers i on) b oot pro g ra m area n ew app lic at i on pro g ra m fl as h m e m or y chi p ram h ost sci fl as h m e m or y prewr i te - erase b oot pro g ra m n ew app lic at i on pro g ra m fl as h m e m or y chi p p ro g ra m e x e c ut i on state ram h ost sci n ew app lic at i on pro g ra m b oot pro g ra m p ro g ra mmi n g c ontro l pro g ra m 1 . i n i t i a l state th e o l d pro g ra m v ers i on or data re m a i ns wr i tten i n t h e fl as h m e m or y. th e user s h ou l d prepare t h e pro g ra mmi n g c ontro l pro g ra m and new app lic at i on pro g ra m be f ore h and i n t h e h ost . 2 . p ro g ra mmi n g c ontro l pro g ra m trans f er wh en boot m ode i s entered , t h e boot pro g ra m i n t h e chi p (or igi na lly i n c orporated i n t h e chi p) i s started and t h e pro g ra mmi n g c ontro l pro g ra m i n t h e h ost i s trans f erred to ram vi a sci c o mm un ic at i on . th e boot pro g ra m re q u i red f or fl as h m e m or y eras i n g i s auto m at ic a lly trans f erred to t h e ram boot pro g ra m area . 3 . fl as h m e m or y i n i t i a liz at i on th e erase pro g ra m i n t h e boot pro g ra m area ( i n ram ) i s e x e c uted , and t h e fl as h m e m or y i s i n i t i a liz ed (to h'ff ) . i n boot m ode , ent i re fl as h m e m or y erasure i s per f or m ed , w i t h out re g ard to b l o ck s . 4. w r i t i n g new app lic at i on pro g ra m th e pro g ra mmi n g c ontro l pro g ra m trans f erred f ro m t h e h ost to ram i s e x e c uted , and t h e new app lic at i on pro g ra m i n t h e h ost i s wr i tten i nto t h e fl as h m e m or y. p ro g ra mmi n g c ontro l pro g ra m b oot pro g ra m b oot pro g ra m b oot pro g ra m area b oot pro g ra m area p ro g ra mmi n g c ontro l pro g ra m figure 17.4 boot mode
section 17 rom rev.7.00 feb. 14, 2007 page 575 of 1108 rej09b0089-0700 ? user program mode fl as h m e m or y chi p chi p ram h ost p ro g ra mmi n g/ erase c ontro l pro g ra m sci b oot pro g ra m n ew app lic at i on pro g ra m fl as h m e m or y ram h ost sci n ew app lic at i on pro g ra m fl as h m e m or y ram h ost sci fl as h m e m or y erase b oot pro g ra m n ew app lic at i on pro g ra m fl as h m e m or y p ro g ra m e x e c ut i on state ram h ost sci b oot pro g ra m b oot pro g ra m fwe assess m ent pro g ra m a pp lic at i on pro g ra m (o l d v ers i on) n ew app lic at i on pro g ra m 1 . i n i t i a l state (1) th e fwe assess m ent pro g ra m t h at c on fi r m s t h at t h e fwe p i n h as been dr iv en high, and (2) t h e pro g ra m t h at w ill trans f er t h e pro g ra mmi n g/ erase c ontro l pro g ra m to on -chi p ram s h ou l d be wr i tten i nto t h e fl as h m e m or y b y t h e user be f ore h and . (3) th e pro g ra mmi n g/ erase c ontro l pro g ra m s h ou l d be prepared i n t h e h ost or i n t h e fl as h m e m or y. 2 . p ro g ra mmi n g/ erase c ontro l pro g ra m trans f er wh en t h e fwe p i n i s dr iv en high, user so f tware c on fi r m s t hi s f a c t , e x e c utes t h e trans f er pro g ra m i n t h e fl as h m e m or y, and trans f ers t h e pro g ra mmi n g/ erase c ontro l pro g ra m to ram. 3 . fl as h m e m or y i n i t i a liz at i on th e pro g ra mmi n g/ erase pro g ra m i n ram i s e x e c uted , and t h e fl as h m e m or y i s i n i t i a liz ed (to h'ff ) . e ras i n g c an be per f or m ed i n b l o ck un i ts , but not i n b y te un i ts . 4. w r i t i n g new app lic at i on pro g ra m n e x t , t h e new app lic at i on pro g ra m i n t h e h ost i s wr i tten i nto t h e erased fl as h m e m or y b l o ck s . d o not wr i te to unerased b l o ck s . p ro g ra mmi n g/ erase c ontro l pro g ra m p ro g ra mmi n g/ erase c ontro l pro g ra m p ro g ra mmi n g/ erase c ontro l pro g ra m t rans f er pro g ra m a pp lic at i on pro g ra m (o l d v ers i on) t rans f er pro g ra m fwe assess m ent pro g ra m fwe assess m ent pro g ra m t rans f er pro g ra m fwe assess m ent pro g ra m t rans f er pro g ra m chi p chi p figure 17.5 user program mode (example)
section 17 rom rev.7.00 feb. 14, 2007 page 576 of 1108 rej09b0089-0700 17.4.5 flash memory emulation in ram reading overlap ram data in user mode and user program mode: emulation should be performed in user mode or user program mode. when the emulation block set in ramer is accessed while the emulation function is being executed, data written in the overlap ram is read. a pp lic at i on pro g ra m ex e c ut i on state fl as h m e m or y em u l at i on b l o ck ram sci ov er l ap ram (e m u l at i on i s per f or m ed on data wr i tten i n ram ) figure 17.6 reading overlap ram data in user mode and user program mode
section 17 rom rev.7.00 feb. 14, 2007 page 577 of 1108 rej09b0089-0700 writing overlap ram data in user program mode: when overlap ram data is confirmed, the rams bit is cleared, ram overlap is released, and writes should actually be performed to the flash memory. when the programming control program is transferred to ram, ensure that the transfer destination and the overlap ram do not overlap, as this will cause data in the overlap ram to be rewritten. a pp lic at i on pro g ra m fl as h m e m or yram sci ov er l ap ram (pro g ra mmi n g data) p ro g ra mmi n g data p ro g ra mmi n g c ontro l pro g ra m ex e c ut i on state figure 17.7 writing overlap ram data in user program mode 17.4.6 differences between boot mode and user program mode table 17.4 differnces between boot mode and user program mode boot mode user program mode entire memory erase yes yes block erase no yes programming control program * program/program-verify erase/erase-verify/program/ program-verify/emulation note: * to be provided by the user, in accordance with the recommended algorithm.
section 17 rom rev.7.00 feb. 14, 2007 page 578 of 1108 rej09b0089-0700 17.4.7 block configuration on-chip 128-kbyte flash memory is divided into one 64-kbyte block, one 32-kbyte block, and eight 4-kbyte blocks. on-chip 256-kbyte flash memory is divided into three 64-kbyte blocks, one 32-kbyte block, and eight 4-kbyte blocks. on-chip 384-kbyte flash memory is divided into five 64-kbyte blocks, one 32-kbyte block, and eight 4-kbyte blocks. a ddress h'3ffff a ddress h' 5 ffff 4 k b y tes 8 32 k b y tes 6 4 k b y tes 2 56 k b y tes 384 k b y tes 6 4 k b y tes 6 4 k b y tes a ddress h'00000 a ddress h'1ffff 4 k b y tes 8 32 k b y tes 6 4 k b y tes 128 k b y tes 6 4 k b y tes 6 4 k b y tes 6 4 k b y tes 6 4 k b y tes 6 4 k b y tes 32 k b y tes 4 k b y tes 8 figure 17.8 flash memory block configuration
section 17 rom rev.7.00 feb. 14, 2007 page 579 of 1108 rej09b0089-0700 17.4.8 pin configuration the flash memory is controlled by means of the pins shown in table 17.5. table 17.5 flash memory pins pin name abbreviation i/o function reset res input reset flash write enable fwe input flash program/erase protection by hardware mode 2 md2 input sets mcu operating mode mode 1 md1 input sets mcu operating mode mode 0 md0 input sets mcu operating mode port f2 pf2 input sets mcu operating mode in programmer mode port f1 pf1 input sets mcu operating mode in programmer mode port f0 pf0 input sets mcu operating mode in programmer mode transmit data txd1 output serial transmit data output receive data rxd1 input serial receive data input
section 17 rom rev.7.00 feb. 14, 2007 page 580 of 1108 rej09b0089-0700 17.4.9 register configuration the registers used to control the on-chip flash memory when enabled are shown in table 17.6. in order to access the flmcr1, flmcr2, ebr1, and ebr2 registers, the flshe bit must be set to 1 in syscr2 (except ramer). table 17.6 flash memory registers register name abbreviation r/w initial value address * 1 flash memory control register 1 flmcr1 * 6 r/w * 3 h'00 * 4 h'ffc8 * 2 flash memory control register 2 flmcr2 * 6 r/w * 3 h'00 h'ffc9 * 2 erase block register 1 ebr1 * 6 r/w * 3 h'00 * 5 h'ffca * 2 erase block register 2 ebr2 * 6 r/w * 3 h'00 * 5 h'ffcb * 2 system control register 2 syscr2 * 7 r/w h'00 h'ff42 ram emulation register ramer r/w h'00 h'fedb notes: 1. lower 16 bits of the address. 2. flash memory. registers selection is performed by the flshe bit in system control register 2 (syscr2). 3. in modes in which the on-chip flash memory is disabled, a read will return h'00, and writes are invalid. writes are also disabled when the fwe bit is cleared to 0 in flmcr1. 4. when a high level is input to the fwe pin, the initial value is h'80. 5. when a low level is input to the fwe pin, or if a high level is input and the swe bit in flmcr1 is not set, these registers are initialized to h'00. 6. flmcr1, flmcr2, ebr1, and ebr2 are 8-bit registers. only byte accesses are valid for these registers, the access requiring 2 states. 7. the syscr2 register can only be used in the f-ztat versions. in the mask rom versions this register will return an undefined value if read, and cannot be modified.
section 17 rom rev.7.00 feb. 14, 2007 page 581 of 1108 rej09b0089-0700 17.5 register descriptions 17.5.1 flash memory control register 1 (flmcr1) bit : 7 6 5 4 3 2 1 0 fwe swe esu psu ev pv e p initial value : 1/0 0 0 0 0 0 0 0 r/w : r r/w r/w r/w r/w r/w r/w r/w flmcr1 is an 8-bit register used for flash memory operating mode control. program-verify mode or erase-verify mode is entered by setting swe to 1 when fwe = 1, then setting the ev or pv bit. program mode is entered by setting swe to 1 when fwe = 1, then setting the psu bit, and finally setting the p bit. erase mode is entered by setting swe to 1 when fwe = 1, then setting the esu bit, and finally setting the e bit. flmcr1 is initialized by a reset, and in hardware standby mode and software standby mode. its initial value is h'80 when a high level is input to the fwe pin, and h'00 when a low level is input. when on-chip flash memory is disabled, a read will return h'00, and writes are invalid. writes to the swe bit in flmcr1 are enabled only when fwe = 1; writes to bits esu, psu, ev, and pv only when fwe = 1 and swe = 1; writes to the e bit only when fwe = 1, swe = 1, and esu = 1; and writes to the p bit only when fwe = 1, swe = 1, and psu = 1. bit 7?flash write enable bit (fwe): sets hardware protection against flash memory programming/erasing. bit 7 fwe description 0 when a low level is input to the fwe pin (hardware-protected state) 1 when a high level is input to the fwe pin bit 6?software write enable bit (swe): enables or disables flash memory programming and erasing. this bit should be set when setting flmcr1 bits 5 to 0, ebr1 bits 7 to 0, and ebr2 bits 3 to 0 * . when swe = 1, the flash memory can only be read in program-verify or erase-verify mode. note: * ebr2 bits 5 to 0 should be set in the h8s/2315 f-ztat and h8s/2314 f-ztat. bits 1 and 0 should be set in the h8s/2317 f-ztat.
section 17 rom rev.7.00 feb. 14, 2007 page 582 of 1108 rej09b0089-0700 bit 6 swe description 0 writes disabled (initial value) 1 writes enabled [setting condition] when fwe = 1 bit 5?erase setup bit (esu): prepares for a transition to erase mode. do not set the swe, psu, ev, pv, e, or p bit at the same time. bit 5 esu description 0 erase setup cleared (initial value) 1 erase setup [setting condition] when fwe = 1 and swe = 1 bit 4?program setup bit (psu): prepares for a transition to program mode. do not set the swe, esu, ev, pv, e, or p bit at the same time. bit 4 psu description 0 program setup cleared (initial value) 1 program setup [setting condition] when fwe = 1 and swe = 1 bit 3?erase-verify (ev): selects erase-verify mode transition or clearing. do not set the swe, esu, psu, pv, e, or p bit at the same time. bit 3 ev description 0 erase-verify mode cleared (initial value) 1 transition to erase-verify mode [setting condition] when fwe = 1 and swe = 1
section 17 rom rev.7.00 feb. 14, 2007 page 583 of 1108 rej09b0089-0700 bit 2?program-verify (pv): selects program-verify mode transition or clearing. do not set the swe, esu, psu, ev, e, or p bit at the same time. bit 2 pv description 0 program-verify mode cleared (initial value) 1 transition to program-verify mode [setting condition] when fwe = 1 and swe = 1 bit 1?erase (e): selects erase mode transition or clearin g. do not set the swe, esu, psu, ev, pv, or p bit at the same time. bit 1 e description 0 erase mode cleared (initial value) 1 transition to erase mode [setting condition] when fwe = 1, swe = 1, and esu = 1 bit 0?program (p): selects program mode transition or clearing. do not set the swe, psu, esu, ev, pv, or e bit at the same time. bit 0 p description 0 program mode cleared (initial value) 1 transition to program mode [setting condition] when fwe = 1, swe = 1, and psu = 1
section 17 rom rev.7.00 feb. 14, 2007 page 584 of 1108 rej09b0089-0700 17.5.2 flash memory control register 2 (flmcr2) bit : 7 6 5 4 3 2 1 0 fler ? ? ? ? ? ? ? initial value : 0 0 0 0 0 0 0 0 r/w : r ? ? ? ? ? ? ? flmcr2 is an 8-bit register that controls the flash memory operating modes. flmcr2 is initialized to h'00 by a reset, and in hardware standby mode and software standby mode. when on-chip flash memory is disabled, a read will return h'00 and writes are invalid. bit 7?flash memory error (fler): indicates that an error has occurred during an operation on flash memory (programming or erasing). when fler is set to 1, flash memory goes to the error- protection state. bit 7 fler description 0 flash memory is operating normally (initial value) flash memory program/erase protection (error protection) is disabled [clearing condition] reset or hardware standby mode 1 an error has occurred during flash memory programming/erasing flash memory program/erase protection (error protection) is enabled [setting condition] see section 17.8.3, error protection bits 6 to 0?reserved: these bits cannot be modified and are always read as 0.
section 17 rom rev.7.00 feb. 14, 2007 page 585 of 1108 rej09b0089-0700 17.5.3 erase block register 1 (ebr1) bit : 7 6 5 4 3 2 1 0 ebr1 eb7 eb6 eb5 eb4 eb3 eb2 eb1 eb0 initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w ebr1 is an 8-bit register that specifies the flash memory erase area block by block. ebr1 is initialized to h'00 by a reset, in hardware standby mode and software standby mode, when a low level is input to the fwe pin, and when a high level is input to the fwe pin and the swe bit in flmcr1 is not set. when a bit in ebr1 is set, the corresponding block can be erased. other blocks are erase-protected. set only one bit in ebr1 and ebr2 together (setting more than one bit will automatically clear all ebr1 and ebr2 bits to 0). when on-chip flash memory is disabled, a read will return h'00 and writes are invalid. the flash memory block configuration is shown in table 17.7. 17.5.4 erase block register 2 (ebr2) bit : 7 6 5 4 3 2 1 0 ebr2 ? ? eb13 * 1 eb12 * 1 eb11 * 2 eb10 * 2 eb9 eb8 initial value : 0 0 0 0 0 0 0 0 r/w : ? ? r/w * 1 r/w * 1 r/w r/w r/w r/w notes: 1. available only in the h8s/2315 f-ztat and h8s/2314 f-ztat. 2. reserved in the h8s/2317 f-ztat. only 0 should be written. ebr2 is an 8-bit register that specifies the flash memory erase area block by block. ebr2 is initialized to h'00 by a reset, in hardware standby mode and software standby mode, when a low level is input to the fwe pin, and when a high level is input to the fwe pin and the swe bit in flmcr1 is not set. when a bit in ebr2 is set, the corresponding block can be erased. other blocks are erase-protected. set only one bit in ebr2 and ebr1 together (setting more than one bit will automatically clear all ebr1 and ebr2 bits to 0, bits 7 to 2 are reserved in the h8s/2317 f-ztat). bits 7 to 4 are reserved (bits 7 and 6 are reserved in the h8s/2315 f-ztat and h8s/2314 f-ztat): they are always read as 0 and cannot be modified. when on-chip flash memory is disabled, a read will return h'00, and writes are invalid. the flash memory block configuration is shown in table 17.7.
section 17 rom rev.7.00 feb. 14, 2007 page 586 of 1108 rej09b0089-0700 table 17.7 flash memory erase blocks block (size) address eb0 (4 kbytes) h'000000 to h'000fff eb1 (4 kbytes) h'001000 to h'001fff eb2 (4 kbytes) h'002000 to h'002fff eb3 (4 kbytes) h'003000 to h'003fff eb4 (4 kbytes) h'004000 to h'004fff eb5 (4 kbytes) h'005000 to h'005fff eb6 (4 kbytes) h'006000 to h'006fff eb7 (4 kbytes) h'007000 to h'007fff eb8 (32 kbytes) h'008000 to h'00ffff eb9 (64 kbytes) h'010000 to h'01ffff eb10 (64 kbytes) * 2 h'020000 to h'02ffff eb11 (64 kbytes) * 2 h'030000 to h'03ffff eb12 (64 kbytes) * 1 h'040000 to h'04ffff eb13 (64 kbytes) * 1 h'050000 to h'05ffff notes: 1. these blocks are valid only in the h8s/2315 f-ztat and h8s/2314 f-ztat. 2. not available in the h8s/2317 f-ztat. 17.5.5 system control register 2 (syscr2) bit : 7 6 5 4 3 2 1 0 ? ? ? ? flshe ? ? ? initial value : 0 0 0 0 0 0 0 0 r/w : ? ? ? ? r/w ? ? ? syscr2 is an 8-bit readable/writable register that performs on-chip flash memory control. syscr2 is initialized to h'00 by a reset and in hardware standby mode. syscr2 can only be used in the f-ztat versions. in the mask rom versions this register will return an undefined value if read, and cannot be modified. bits 7 to 4?reserved: these bits cannot be modified and are always read as 0.
section 17 rom rev.7.00 feb. 14, 2007 page 587 of 1108 rej09b0089-0700 bit 3?flash memory control register enable (flshe): controls cpu access to the flash memory control registers (flmcr1, flmcr2, ebr1, and ebr2). writing 1 to the flshe bit enables the flash memory control registers to be read and written to. clearing flshe to 0 designates these registers as unselected (the register contents are retained). bit 3 flshe description 0 flash control registers are not selected for addresses h'ffffc8 to h'ffffcb (initial value) 1 flash control registers are selected for addresses h'ffffc8 to h'ffffcb bits 2 to 0?reserved: these bits cannot be modified and are always read as 0. 17.5.6 ram emulation register (ramer) bit : 7 6 5 4 3 2 1 0 ? ? ? ? rams ram2 ram1 ram0 initial value : 0 0 0 0 0 0 0 0 r/w : ? ? ? ? r/w r/w r/w r/w ramer specifies the area of flash memory to be overlapped with part of ram when emulating real-time flash memory programming. ramer is initialized to h'00 by a reset and in hardware standby mode. it is not initialized in software standby mode. ramer settings should be made in user mode or user program mode. flash memory area divisions are shown in table 17. 8. to ensure correct operation of the emulation function, the rom for which ram emulation is performed should not be accessed immediately after this register has been modified. normal execution of an access immediately after register modification is not guaranteed. note: ram emulation function is not supported in the h8s/2314 f-ztat. bits 7 to 4?reserved: these bits cannot be modified and are always read as 0.
section 17 rom rev.7.00 feb. 14, 2007 page 588 of 1108 rej09b0089-0700 bit 3?ram select (rams): specifies selection or non-selection of flash memory emulation in ram. when rams = 1, all flash memory blocks are program/erase-protected. bit 3 rams description 0 emulation not selected (initial value) program/erase-protection of all flash memory blocks is disabled 1 emulation selected program/erase-protection of all flash memory blocks is enabled bits 2 to 0?flash memory area selection (ram2 to ram0): these bits are used together with bit 3 to select the flash memory area to be overlapped with ram (see table 17.8). table 17.8 flash memory area divisions ram area block name rams ram2 ram1 ram0 h'ffdc00 to h'ffebff ram area, 4 kbytes 0 h'000000 to h'000fff eb0 (4 kbytes) 1 0 0 0 h'001000 to h'001fff eb1 (4 kbytes) 1 0 0 1 h'002000 to h'002fff eb2 (4 kbytes) 1 0 1 0 h'003000 to h'003fff eb3 (4 kbytes) 1 0 1 1 h'004000 to h'004fff eb4 (4 kbytes) 1 1 0 0 h'005000 to h'005fff eb5 (4 kbytes) 1 1 0 1 h'006000 to h'006fff eb6 (4 kbytes) 1 1 1 0 h'007000 to h'007fff eb7 (4 kbytes) 1 1 1 1 : don?t care
section 17 rom rev.7.00 feb. 14, 2007 page 589 of 1108 rej09b0089-0700 17.6 on-board programming modes when pins are set to on-board programming mode, program/erase/verify operations can be performed on the on-chip flash memory. there are two on-board programming modes: boot mode and user program mode. the pin settings for transition to each of these modes are shown in table 17.9. for a diagram of the transitions to the various flash memory modes, see figure 17.3. table 17.9 setting on-board programming modes modes pins mcu mode cpu operating mode fwe md2 md1 md0 boot mode advanced expanded mode with on-chip rom enabled 1 0 1 0 advanced single-chip mode 1 user program mode * advanced expanded mode with on-chip rom enabled 1 1 1 0 advanced single-chip mode 1 note: * normally, user mode should be used. set the fwe pin to 1 to make a transition to user program mode before performing a program/erase/verify operation.
section 17 rom rev.7.00 feb. 14, 2007 page 590 of 1108 rej09b0089-0700 17.6.1 boot mode when boot mode is used, the flash memory programming control program must be prepared in the host beforehand. the channel 1 sci to be used is set to asynchronous mode. when a reset-start is executed after the h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, or h8s/2314 f-ztat chip?s pins have been set to boot mode, the boot program built into the chip is started and the programming control program prepared in the host is serially transmitted to the chip via the sci. in the chip, the programming control program received via the sci is written into the programming control program area in on-chip ram. after the transfer is completed, control branches to the start addre ss of the programming control program area and the programming control program execution state is entered (flash memory programming is performed). the transferred programming control program must therefore include coding that follows the programming algorithm given later. the system configuration in boot mode is shown in figure 17.9, and the boot program mode execution procedure in figure 17.10. rxd 1 t xd 1 sc i1 ch ip flas h m e m or y w rite data re c eption veri fy data trans m ission host o n- ch ip ram figure 17.9 system configuration in boot mode
section 17 rom rev.7.00 feb. 14, 2007 page 591 of 1108 rej09b0089-0700 note: i f a m e m or y c ell does not operate nor m all y and c annot be erased , one h'ff b y te is trans m itted as an erase error , and t h e erase operation and subse q uent operations are h alted. s tart s et pins to boot m ode and e x e c ute reset-start host trans f ers data (h'00) c ontinuousl y at pres c ribed bit rate ch ip m easures low period o f h'00 data trans m itted b y h ost ch ip c al c ulates bit rate and sets v alue in bit rate re g ister af ter bit rate adjust m ent , ch ip trans m its one h'00 data b y te to h ost to indi c ate end o f adjust m ent host c on f ir m s nor m al re c eption o f bit rate adjust m ent end indi c ation (h'00) , and trans m its one h' 55 data b y te af ter re c ei v in g h' 55, ch ip trans m its one h' aa data b y te to h ost host trans m its nu m ber o f pro g ra mm in g c ontrol pro g ra m b y tes (n) , upper b y te f ollowed b y lower b y te ch ip trans m its re c ei v ed nu m ber o f b y tes to h ost as v eri fy data (e ch o-ba ck ) n = 1 host trans m its pro g ra mm in g c ontrol pro g ra m se q uentiall y in b y te units ch ip trans m its re c ei v ed pro g ra mm in g c ontrol pro g ra m to h ost as v eri fy data (e ch o-ba ck ) trans f er re c ei v ed pro g ra mm in g c ontrol pro g ra m to on- ch ip ram n = n? no yes end o f trans m ission ch e ck f las h m e m or y data , and i f data h as alread y been written , erase all blo ck s af ter c on f ir m in g t h at all f las h m e m or y data h as been erased , ch ip trans m its one h' aa data b y te to h ost e x e c ute pro g ra mm in g c ontrol pro g ra m trans f erred to on- ch ip ram n + 1 n figure 17.10 boot mode execution procedure
section 17 rom rev.7.00 feb. 14, 2007 page 592 of 1108 rej09b0089-0700 automatic sci bit rate adjustment: when boot mode is initiated, the h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, or h8s/2314 f-ztat chip measures the low period of the asynchronous sci communication data (h'00) transmitted continuously from the host. the sci transmit/receive format should be set as follows: 8-bit data, 1 stop bit, no parity. the chip calculates the bit rate of the transmission from the host from the measured low period, and transmits one h'00 byte to the host to indicate the end of bit rate adjustment. the host should confirm that this adjustment end indication (h' 00) has been received normally, and transmit one h'55 byte to the chip. if reception cannot be perf ormed normally, initiate boot mode again (reset), and repeat the above operations. depending on the host?s transmission bit rate and the chip?s system clock frequency, there will be a discrepancy between the bit rates of the host and the chip. to ensure correct sci operation, the host?s transfer bit rate should be set to 9,600 or 19,200 bps. table 17.10 shows typical host transfer bit rates and system clock frequencies for which automatic adjustment of the mcu?s bit rate is possible. the boot program should be executed within this system clock range. s tart bit s top bit d 0 d 1 d 2 d 3 d 4 d5 d6 d 7 low period (9 bits) m easured (h'00 data) hi gh period (1 or m ore bits ) figure 17.11 automatic sci bit rate adjustment table 17.10 system clock frequencies for which automatic adjustment of h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, or h8s/2314 f-ztat bit rate is possible host bit rate system clock frequency for which automatic adjustment of h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, or h8s/2314 f-ztat bit rate is possible 19,200 bps 16 to 25 mhz 9,600 bps 8 to 25 mhz
section 17 rom rev.7.00 feb. 14, 2007 page 593 of 1108 rej09b0089-0700 on-chip ram area divisions in boot mode: in boot mode, the 2-kbyte area from h'ffdc00 to h'ffe3ff is reserved for use by the boot program, as shown in figure 17.12. the area to which the programming control program is transferred is h'ffe400 to h'fffbff. the boot program area can be used when the programming control program transferred into ram enters the execution state. a stack area should be set up as required. h'ff dc 00 h'ffe3ff p ro g ra mm in g c ontrol pro g ra m area ( 6 k b y tes) h'fff b ff b oot pro g ra m area * (2 k b y tes) note: * t h e boot pro g ra m area c annot be used until a transition is m ade to t h e e x e c ution state f or t h e pro g ra mm in g c ontrol pro g ra m trans f erred to ram . note t h at t h e boot pro g ra m re m ains stored in t h is area a f ter a bran ch is m ade to t h e pro g ra mm in g c ontrol pro g ra m . figure 17.12 ram areas in boot mode h8s/2314 f-ztat on-chip ram area divisions in boot mode: in boot mode, the 2-kbyte area from h'ffdc00 to h'ffe3ff is reserved for boot program use, as shown in figure 17.13. the area to which the programming control program is transferred is h'ffe400 to h'fffbff. the boot program area becomes available when a transition is made to the execution state for the programming control program transferred to ram. a stack area should be set as required. the 4-kbyte area from h'ffdc00 to h'ffebff is a reserved area used only in boot mode. it should not be used for any purpose other than flash memory programming/erasing.
section 17 rom rev.7.00 feb. 14, 2007 page 594 of 1108 rej09b0089-0700 h'ff dc 00 h'ffe3ff h'ffe b ff h'ffe c 00 p ro g ra mm in g c ontrol pro g ra m area ( 6 k b y tes) h'fff b ff b oot pro g ra m area (2 k b y tes) * 2 r eser v ed area used onl y in boot m ode (4 k b y tes) * 1 notes: 1. t h is is a reser v ed area used onl y in boot m ode. it s h ould not be used f or an y purpose ot h er t h an f las h m e m or y pro g ra mm in g /erasin g . 2. t h is area c annot be used until a transition is m ade to t h e e x e c ution state f or t h e pro g ra mm in g c ontrol pro g ra m trans f erred to ram . note also t h at t h e boot pro g ra m re m ains in t h is area in ram e v en a f ter c ontrol bran ch es to t h e pro g ra mm in g c ontrol pro g ra m . figure 17.13 ram areas in boot mode notes on use of boot mode ? when the chip comes out of reset in boot mode, it measures the low-level period of the input at the sci?s rxd1 pin. the reset should end with rxd1 high. after the reset ends, it takes approximately 100 states before the chip is ready to measure the low-level period of the rxd1 pin. ? in boot mode, if any data has been programmed into the flash memory (if all data is not 1), all flash memory blocks are erased. boot mode is for use when user program mode is unavailable, such as the first time on-board programming is performed, or if the program activated in user program mode is accidentally erased. ? interrupts cannot be used while the flash memory is being programmed or erased. ? the rxd1 and txd1 pins should be pulled up on the board. ? before branching to the programming control program (ram area h'ffe400 to h'fffbff), the chip terminates transmit and receive operations by the on-chip sci (channel 1) (by clearing the re and te bits in scr to 0), but the adjusted bit rate value remains set in brr. the transmit data output pin, txd1, goes to the high-level output state (p31ddr = 1, p31dr = 1).
section 17 rom rev.7.00 feb. 14, 2007 page 595 of 1108 rej09b0089-0700 the contents of the cpu?s internal general registers are undefined at this time, so these registers must be initialized immediately after branching to the programming control program. in particular, since the stack pointer (sp) is used implicitly in subroutine calls, etc., a stack area must be specified for use by the programming control program. initial settings must also be made for the other on-chip registers. ? boot mode can be entered by making the pin settings shown in table 17.9 and executing a reset-start. boot mode can be cleared by driving the reset pin low, waiting at least 20 states, then setting the fwe pin and mode pins, and executing reset release * 1 . boot mode can also be cleared by a wdt overflow reset. do not change the mode pin input levels in boot mode, and do not drive the fwe pin low while the boot program is being executed or while flash memory is being programmed or erased * 2 . ? if the mode pin input levels are changed (for example, from low to high) during a reset, the state of ports with multiplexed address functions and bus control output pins ( as , rd , hwr ) will change according to the change in the microcomputer?s operating mode * 3 . therefore, care must be taken to make pin settings to prevent these pins from becoming output signal pins during a reset, or to prevent collision with signals outside the microcomputer. notes: 1. mode pins and fwe pin input must satisfy the mode programming setup time (t mds = 200 ns) with respect to the reset release timing, as shown in figures 17.30 to 17.32. 2. for further information on fwe application and disconnection, see section 17.12, flash memory programming and erasing precautions. 3. see section 8, i/o ports. 17.6.2 user program mode when set to user program mode, the chip can program and erase its flash memory by executing a user program/erase control program. therefore, on-board reprogramming of the on-chip flash memory can be carried out by providing on-board means of fwe control and supply of programming data, and storing a program/erase control program in part of the program area as necessary. to select user program mode, select a mode that enables the on-chip flash memory (mode 6 or 7), and apply a high level to the fwe pin. in this mode, on-chip supporting modules other than flash memory operate as they normally would in modes 6 and 7.
section 17 rom rev.7.00 feb. 14, 2007 page 596 of 1108 rej09b0089-0700 the flash memory itself cannot be read while the swe bit is set to 1 to perform programming or erasing, so the control program that performs programming and erasing should be run in on-chip ram or external memory. when the program is located in external memory, an instruction for programming the flash memory and the following instruction should be located in on-chip ram. figure 17.14 shows the procedure for executing the program/erase control program when transferred to on-chip ram. c lear f w e * f w e = h i gh * b ran ch to f las h m e m or y appli c ation pro g ra m b ran ch to pro g ra m /erase c ontrol pro g ra m in ram area e x e c ute pro g ra m /erase c ontrol pro g ra m ( f las h m e m or y rewritin g ) trans f er pro g ra m /erase c ontrol pro g ra m to ram md 2 , md 1 , md 0 = 110 , 111 r eset-start w rite t h e f w e assess m ent pro g ra m and trans f er pro g ra m (and t h e pro g ra m /erase c ontrol pro g ra m i f ne c essar y ) be f ore h and notes: d o not appl y a c onstant h i gh le v el to t h e f w e pin. a ppl y a h i gh le v el to t h e f w e pin onl y w h en t h e f las h m e m or y is pro g ra mm ed or erased. a lso , w h ile a h i gh le v el is applied to t h e f w e pin , t h e wat ch do g ti m er s h ould be a c ti v ated to pre v ent o v erpro g ra mm in g or o v ererasin g due to pro g ra m runawa y, et c . * for f urt h er in f or m ation on f w e appli c ation and dis c onne c tion , see se c tion 17.12 , flas h m e m or y p ro g ra mm in g and erasin g p re c autions. figure 17.14 user program mode execution procedure
section 17 rom rev.7.00 feb. 14, 2007 page 597 of 1108 rej09b0089-0700 17.7 programming/erasing flash memory in the on-board programming modes, flash memory programming and erasing is performed by software, using the cpu. there are four flash memory operating modes: program mode, erase mode, program-verify mode, and erase-verify mode. transition to these modes can be made for the on-chip rom area by setting the psu, esu, p, e, pv, and ev bits in flmcr1. the flash memory cannot be read while being programmed or erased. therefore, the program that controls flash memory programming/erasing (the programming control program) should be located and executed in on-chip ram or external memory. when the program is located in external memory, an instruction for programming the flash memory and the following instruction should be located in on-chip ram. the dtc should not be activated before or after the instruction for programming the flash memory is executed. notes: 1. operation is not guaranteed if setting/resetting of the swe, esu, psu, ev, pv, e, and p bits in flmcr1 is executed by a program in flash memory. 2. when programming or erasing, set fwe to 1 (programming/erasing will not be executed if fwe = 0). 3. perform programming in the erased state. do not perform additional programming on previously programmed addresses. 17.7.1 program mode follow the procedure shown in the program/program-verify flowchart in figure 17.15 to write data or programs to flash memory. performing program operations according to this flowchart will enable data or programs to be written to flash memory without subjecting the device to voltage stress or sacrificing program data reliability. programming should be carried out 128 bytes at a time. for the wait times (x, y, z1, z2, z3, , ?, , , , ) after bits are set or cleared in flash memory control register 1 (flmcr1) and the maximum number of programming operations (n), see section 20.3.6, flash memory characteristics. following the elapse of (x) s or more after the swe bit is set to 1 in flash memory control register 1 (flmcr1), 128-byte program data is stored in the program data area and reprogram data area, and the 128-byte data in the reprogram data area is written consecutively to the write addresses. the lower 8 bits of the first address written to must be h'00 or h'80. 128 consecutive byte data transfers are performed. the program address and program data are latched in the flash memory. a 128-byte data transfer must be performed even if writing fewer than 128 bytes; in this case, h'ff data must be written to the extra addresses.
section 17 rom rev.7.00 feb. 14, 2007 page 598 of 1108 rej09b0089-0700 next, the watchdog timer is set to prevent overprogramming in the event of program runaway, etc. set a value greater than (y + z2 + + ) s as the wdt overflow period. after this, preparation for program mode (program setup) is carried out by setting the psu bit in flmcr1, and after the elapse of (y) s or more, the operating mode is switched to program mode by setting the p bit in flmcr1. the time during which the p bit is set is the flash memory programming time. set the programming time according to the table in the programming flowchart. 17.7.2 program-verify mode in program-verify mode, the data written in program mode is read to check whether it has been correctly written in the flash memory. after the elapse of a given programming time, the programming mode is exited (the p bit in flmcr1 is cleared to 0, then the psu bit is cleared to 0 at least ( ) s later). next, the watchdog timer is cleared after the elapse of ( ) s or more, and the operating mode is switched to program- verify mode by setting the pv bit in flmcr1. before reading in program-verify mode, a dummy write of h'ff data should be made to the addresses to be read. the dummy write should be executed after the elapse of ( ) s or more. when the flash memory is read in this state (verify data is read in 16-bit units), the data at th e latched address is read. wait at least ( ) s after the dummy write before performing this read operation. next, the originally written data is compared with the verify data, and reprogram data is computed (see figure 17.15) and transferred to the reprogram data area. after 128 bytes of data have been verified, exit program-verify mode, wait for at least ( ) s, then clear the swe bit in flmcr1 to 0, and wait again for at least ( ) s. if reprogramming is necessary, set program mode again, and repeat the program/program-verify sequence as before. however, ensure that the program/program-verify sequence is not repeated more than (n) times on the same bits.
section 17 rom rev.7.00 feb. 14, 2007 page 599 of 1108 rej09b0089-0700 s tart e nd o f pro g ra mmi n g e nd sub s et swe b i t i n flmcr 1 w a i t ( x ) s n = 1 m = 0 s ub - rout i ne -c a ll s ee n ote * 7 f or pu l se w i dt h n ote : 7 . w r i te p u l se wi dt h s tart o f pro g ra mmi n g s ub - rout i ne wr i te pu l se s et psu b i t i n flmcr 1 e nab l e wdt s et p b i t i n flmcr 1 w a i t ( y ) s cl ear p b i t i n flmcr 1 w a i t ( z 1) s or ( z 2) s or ( z 3) s cl ear psu b i t i n flmcr 1 w a i t ( ) s di sab l e wdt w a i t ( ) s w r i te pu l se app lic at i on subrout i ne ng ng ng ng ng ng ok ok ok ok ok w a i t ( ) s w a i t ( ) s * 2 * 4 * 6 * 6 * 6 * 6 * 6 * 6 * 6 * 6 * 6 * 5 * 6 * 6 * 6 * 6 * 6 * 1 s et p v b i t i n flmcr 1 h'ff du mmy wr i te to v er ify address r ead v er ify data a dd i t i ona l pro g ra m data c o m putat i on t rans f er add i t i ona l pro g ra m data to add i t i ona l pro g ra m data area r ead data = v er ify data? * 4 * 1 * 4 * 3 r epro g ra m data c o m putat i on cl ear p v b i t i n flmcr 1 cl ear swe b i t i n flmcr 1 m = 1 128 - b y te data v er ific at i on c o m p l eted? m = 0? 6 n ? 6 n ? i n c re m ent address p ro g ra mmi n g f a il ure ok cl ear swe b i t i n flmcr 1 n n ? r epro g ra m d ata ( x' ) 0 1 ver ify d ata (v) 0 1 0 1 a dd i t i ona l p ro g ra m d ata ( y ) 0 1 c o mm ents a dd i t i ona l pro g ra mmi n g e x e c uted a dd i t i ona l pro g ra mmi n g not e x e c uted a dd i t i ona l pro g ra mmi n g not e x e c uted a dd i t i ona l pro g ra mmi n g not e x e c uted a dd i t i ona l p ro g ra m d ata o perat i on ch art w r i te 128 - b y te data i n ram repro g ra m data area c onse c ut iv e ly to fl as h m e m or y w r i te pu l se ( z 1) s or ( z 2) s ram p ro g ra m data area (128 b y tes) r epro g ra m data area (128 b y tes) a dd i t i ona l pro g ra m data area (128 b y tes) s tore 128 - b y te pro g ra m data i n pro g ra m data area and repro g ra m data area n u m ber o f w r i tes (n) 1 2 3 4 5 6 7 8 9 10 11 12 13 . . . 998 999 1000 w r i te tim e ( z ) s z 1 z 1 z 1 z 1 z 1 z 1 z 2 z 2 z 2 z 2 z 2 z 2 z 2 . . . z 2 z 2 z 2 n otes : 1 . d ata trans f er i s per f or m ed b y b y te trans f er . th e l ower 8 b i ts o f t h e fi rst address wr i tten to m ust be h' 00 or h' 80 . a 128 - b y te data trans f er m ust be per f or m ed e v en if wr i t i n g f ewer t h an 128 b y tes ; i n t hi s c ase , h'ff data m ust be wr i tten to t h e e x tra addresses . 2 . ver ify data i s read i n 1 6- b i t ( w ) un i ts . 3 . ev en b i ts f or w hich pro g ra mmi n g h as been c o m p l eted i n t h e 128 - b y te pro g ra mmi n g l oop w ill be subje c ted to add i t i ona l pro g ra mmi n g if t h e y f a il t h e subse q uent v er ify operat i on . 4. a 128 - b y te area f or stor i n g pro g ra m data , a 128 - b y te area f or stor i n g repro g ra m data , and a 128 - b y te area f or stor i n g add i t i ona l pro g ra m data s h ou l d be pro vi ded i n ram. th e c ontents o f t h e repro g ra m data and add i t i ona l pro g ra m data areas are m od ifi ed as pro g ra mmi n g pro c eeds . 5. a wr i te pu l se o f ( z 1) or ( z 2) m s s h ou l d be app li ed a cc ord i n g to t h e pro g ress o f pro g ra mmi n g. s ee note 7 f or t h e pu l se w i dt h s . wh en t h e add i t i ona l pro g ra m data i s pro g ra mm ed , a wr i te pu l se o f ( z 3) s s h ou l d be app li ed . r epro g ra m data x' stands f or repro g ra m data to w hich a wr i te pu l se h as been app li ed . 6. f or t h e v a l ues o f x, y, z 1 , z 2 , z 3 , , , , , , , and n, see se c t i on 20 . 3 .6, fl as h m e m or y ch ara c ter i st ic s . o r igi na l d ata ( d ) 0 1 ver ify d ata (v) 0 1 0 1 r epro g ra m d ata ( x ) 1 0 1 c o mm ents p ro g ra mmi n g c o m p l eted p ro g ra mmi n g i n c o m p l ete ; repro g ra m s t ill i n erased state ; no a c t i on p ro g ra m d ata o perat i on ch art t rans f er repro g ra m data to repro g ra m data area n n + 1 n ote : u se a ( z 3) s wr i te pu l se f or add i t i ona l pro g ra mmi n g. s e q uent i a lly wr i te 128 - b y te data i n add i t i ona l pro g ra m data area i n ram to fl as h m e m or y w r i te p u l se ( z 3) s add i t i ona l wr i te pu l se w a i t ( ) s w a i t ( ) s w a i t ( ) s p er f or m pro g ra mmi n g i n t h e erased state . d o not per f or m add i t i ona l pro g ra mmi n g on pre vi ous ly pro g ra mm ed addresses . figure 17.15 program/program-verify flowchart
section 17 rom rev.7.00 feb. 14, 2007 page 600 of 1108 rej09b0089-0700 17.7.3 erase mode flash memory erasing should be performed block by block following the procedure shown in the erase/erase-verify flowchart (single-block erase) shown in figure 17.16. for the wait times (x, y, z, , ?, , , , ) after bits are set or cleared in flash memory control register 1 (flmcr1) and the maximum number of programming operations (n), see section 20.3.6, flash memory characteristics. to perform data or program erasure, make a 1 bit setting for the flash memory area to be erased in erase block register 1 or 2 (ebr1 or ebr2) at least (x) s after setting the swe bit to 1 in flash memory control register 1 (flmcr1). next, the watchdog timer is set to prevent overerasing in the event of program runaway, etc. set a value greater than (y + z + + ?) ms as the wdt overflow period. after this, preparation for erase mode (erase setup) is carried out by setting the esu bit in flmcr1, and after the elapse of (y) s or more, the operating mode is switched to erase mode by setting the e bit in flmcr1. the time during which the e bit is set is the flash memory erase time. ensure that the erase time does not exceed (z) ms. note: with flash memory erasing, prewriting (setting all data in the memory to be erased to 0) is not necessary before starting the erase procedure. 17.7.4 erase-verify mode in erase-verify mode, data is read after memory has been erased to check whether it has been correctly erased. after the elapse of the erase time, erase mode is ex ited (the e bit in flmcr1 is cleared to 0, then the esu bit in flmcr1 is cleared to 0 at least ( ) s later), the watchdog timer is cleared after the elapse of ( ) s or more, and the operating mode is switched to erase-verify mode by setting the ev bit in flmcr1. before reading in erase-verify mode, a dummy write of h'ff data should be made to the addresses to be read. the dummy write should be executed after the elapse of ( ) s or more. when the flash memory is read in this state (verify data is read in 16-bit units), the data at the latched address is read. wait at least ( ) s after the dummy write before performing this read operation. if the read data has been eras ed (all 1), a dummy write is performed to the next address, and erase-verify is performed. if the read data has not been erased, set erase mode again, and repeat the erase/erase-verify sequence in the same way. however, ensure that the erase/erase- verify sequence is not repeated more than (n) times. when verification is completed, exit erase- verify mode, and wait for at least ( ) s. if erasure has been completed on all the erase blocks, clear the swe bit in flmcr1 to 0 and wait for at least ( ) s. if there are any unerased blocks, make a 1 bit setting for the flash memory area to be erased, and repeat the erase/erase-verify sequence in the same way.
section 17 rom rev.7.00 feb. 14, 2007 page 601 of 1108 rej09b0089-0700 end o f erasin g s tart s et sw e bit in fl mcr 1 s et e su bit in fl mcr 1 s et e bit in fl mcr 1 w ait ( x ) s w ait ( y ) s n = 1 s et e br 1 , e br 2 enable wd t * 2 * 2 * 4 w ait ( z ) m s * 2 w ait ( ) s * 2 w ait ( ) s * 2 w ait ( ) s s et blo ck start address to v eri fy address * 2 w ait ( ) s * 2 * 3 * 2 w ait ( ) s * 2 * 2 * 5 s tart o f erase c lear e bit in fl mcr 1 c lear e su bit in fl mcr 1 s et ev bit in fl mcr 1 h'ff du mmy write to v eri fy address r ead v eri fy data c lear ev bit in fl mcr 1 w ait ( ) s c lear ev bit in fl mcr 1 c lear sw e bit in fl mcr 1 d isable wd t halt erase * 1 veri fy data = all 1? last address o f blo ck ? end o f erasin g o f all erase blo ck s? erase f ailure c lear sw e bit in fl mcr 1 n n? n g n g n g n g o k o k o k o k n n + 1 in c re m ent address notes: 1. p rewritin g (settin g erase blo ck data to all 0) is not ne c essar y . 2. t h e v alues o f x, y, z, , , , , , , and n are s h own in se c tion 20.3. 6, flas h m e m or y ch ara c teristi c s. 3. veri fy data is read in 1 6 -bit ( w ) units. 4. s et onl y one bit in e br 1or e br 2. m ore t h an one bit c annot be set. 5 . erasin g is per f or m ed in blo ck units. to erase a nu m ber o f blo ck s , t h e indi v idual blo ck s m ust be erased se q uentiall y . w ait ( ) s w ait ( ) s figure 17.16 erase/er ase-verify flowchart
section 17 rom rev.7.00 feb. 14, 2007 page 602 of 1108 rej09b0089-0700 17.8 flash memory protection there are three kinds of flash memory program/erase protection: hardware protection, software protection, and error protection. 17.8.1 hardware protection hardware protection refers to a state in which programming/erasing of flash memory is forcibly disabled or aborted. settings in flash memory control registers 1 and 2 (flmcr1, flmcr2) and erase block registers 1 and 2 (ebr1, ebr2) are reset (see table 17.11). table 17.11 hardware protection functions item description program erase fwe pin protection ? when a low level is input to the fwe pin, flmcr1, flmcr2, ebr1, and ebr2 are initialized, and the program/erase-protected state is entered. yes yes reset/standby protection ? in a reset (including a wdt overflow reset) and in standby mode, flmcr1, flmcr2, ebr1, and ebr2 are initialized, and the program/erase-protected state is entered. ? in a reset via the res pin, the reset state is not entered unless the res pin is held low until oscillation stabilizes after powering on. in the case of a reset during operation, hold the res pin low for the res pulse width specified in section 20.3.3, ac characteristics. yes yes 17.8.2 software protection software protection can be implemented by setting the swe bit in flash memory control register 1 (flmcr1), erase block registers 1 and 2 (ebr1, ebr2), and the rams bit in the ram emulation register (ramer). when software protection is in effect, setting the p or e bit in flmcr1 does not cause a transition to program mode or erase mode (see table 17.12).
section 17 rom rev.7.00 feb. 14, 2007 page 603 of 1108 rej09b0089-0700 table 17.12 software protection functions item description program erase swe bit protection ? clearing the swe bit to 0 in flmcr1 sets the program/erase-protected state for all blocks (execute in on-chip ram or external memory.) yes yes block specification protection ? erase protection can be set for individual blocks by settings in erase block registers 1 and 2 (ebr1, ebr2). ? setting ebr1 and ebr2 to h'00 places all blocks in the erase-protected state. ? yes emulation protection ? setting the rams bit to 1 in the ram emulation register (ramer) places all blocks in the program/erase-protected state. yes yes 17.8.3 error protection in error protection, an error is detected wh en mcu runaway occurs during flash memory programming/erasing, or operation is not performed in accordance with the program/erase algorithm, and the program/erase operation is aborted. aborting the program/erase operation prevents damage to the flash memory due to overprogramming or overerasing. if the mcu malfunctions during flash memory programming/erasing, the fler bit is set to 1 in flmcr2 and the error protection state is entered. the flmcr1, flmcr2, ebr1, and ebr2 settings are retained, but program mode or erase mode is aborted at the point at which the error occurred. program mode or erase mode cannot be re-entered by re-setting the p or e bit. however, pv and ev bit setting is enabled, and a transition can be made to verify mode. fler bit setting conditions are as follows: ? when flash memory is read during programming/erasing (including a vector read or instruction fetch) ? immediately after exception handling (excluding a reset) during programming/erasing ? when a sleep instruction (including software standby) is executed during programming/erasing
section 17 rom rev.7.00 feb. 14, 2007 page 604 of 1108 rej09b0089-0700 ? when a bus master other than the cpu (the dtc) has control of the bus during programming/erasing error protection is released only by a reset and in hardware standby mode. figure 17.17 shows the flash memory state transition diagram. rd vf pr e r fle r = 0 error o cc urren c e r e s = 0 or s tby = 0 r e s = 0 or s tby = 0 r d vf p r e r fle r = 0 nor m al operatin g m ode p ro g ra m m ode erase m ode r eset or h ardware standb y ( h ardware prote c tion) rd vf p r e r fle r = 1 r d vf p r e r fle r = 1 error prote c tion m ode error prote c tion m ode (so f tware standb y ) s o f tware standb y m ode fl mcr 1 , fl mcr 2 (e xc ept fle r bit) , e br 1 , e br 2 initiali z ation state fl mcr 1 , fl mcr 2 , e br 1 , e br 2 initiali z ation state s o f tware standb y m ode release rd : m e m or y read possible vf: veri fy -read possible pr : p ro g ra mm in g possible e r : erasin g possible r d : m e m or y read not possible vf : veri fy -read not possible p r : p ro g ra mm in g not possible e r : erasin g not possible le g end: r e s = 0 or s tby = 0 error o cc urren c e (so f tware standb y ) figure 17.17 flash memory state transitions
section 17 rom rev.7.00 feb. 14, 2007 page 605 of 1108 rej09b0089-0700 17.9 flash memory emulation in ram 17.9.1 emulation in ram making a setting in the ram emulation register (ramer) enables part of ram to be overlapped onto the flash memory area so that data to be written to flash memory can be emulated in ram in real time. after the ramer setting has been made, accesses can be made from the flash memory area or the ram area overlapping flash memory. emulation can be performed in user mode and user program mode. figure 17.18 shows an example of emulation of real-time flash memory programming. note: flash memory emulation by ram is not supported in the h8s/2314 f-ztat. s tart o f e m ulation pro g ra m end o f e m ulation pro g ra m tunin g o k? yes no s et ram e r w rite tunin g data to o v erlap ram e x e c ute appli c ation pro g ra m c lear ram e r w rite to f las h m e m or y e m ulation blo ck figure 17.18 flowchart for flash memory emulation in ram
section 17 rom rev.7.00 feb. 14, 2007 page 606 of 1108 rej09b0089-0700 17.9.2 ram overlap an example in which flash memory block area eb1 is overlapped is shown below. h'00000 h'01000 h'02000 h'03000 h'04000 h'0 5 000 h'0 6 000 h'07000 h'08000 h'3ffff (h' 5 ffff) * 1 (h'1ffff) * 2 flas h m e m or y e b 8 to e b 11 (e b 8 to e b 13) * 1 (e b 8 and e b 9) * 2 t h is area c an be a cc essed f ro m bot h t h e ram area and f las h m e m or y area e b 0 e b 1 e b 2 e b 3 e b 4 e b5 e b6 e b 7 h'ff dc 00 h'ffe b ff h'fff b ff o n- ch ip ram notes: 1. h' 5 ffff , e b 8 to e b 13 in t h e h8 s /231 5 f-zt a t. 2. h'1ffff , e b 8 and e b 9 in t h e h8 s /2317 f-zt a t. figure 17.19 example of ram overlap operation example in which flash memory block area eb1 is overlapped 1. set bits rams, ram2, ram1, and ram0 in ramer to 1, 0, 0, 1, to overlap part of ram onto the area (eb1) for which real-time programming is required. 2. real-time programming is performed using the overlapping ram. 3. after the program data has been confirmed, the rams bit is cleared, releasing ram overlap. 4. the data written in the overlapping ram is written into the flash memory space (eb1).
section 17 rom rev.7.00 feb. 14, 2007 page 607 of 1108 rej09b0089-0700 notes: 1. when the rams bit is set to 1, program/erase protection is enabled for all blocks regardless of the value of ram2, ram1, and ram0 (emulation protection). in this state, setting the p or e bit in flash memory control register 1 (flmcr1) will not cause a transition to program mode or erase mode. when actually programming a flash memory area, the rams bit should be cleared to 0. 2. a ram area cannot be erased by execution of software in accordance with the erase algorithm while flash memory emulation in ram is being used. 3. block area eb0 includes the vector table. when performing ram emulation, the vector table is needed by the overlap ram. 17.10 interrupt handling when programming/erasing flash memory all interrupts, including nmi input, are disabled when flash memory is being programmed or erased (when the p or e bit is set in flmcr1), and while the boot program is executing in boot mode * 1 , to give priority to the program or eras e operation. there are three reasons for this: 1. interrupt during programming or erasing might cause a violation of the programming or erasing algorithm, with the result that normal operation could not be assured. 2. in the interrupt exception handling sequence during programming or erasing, the vector would not be read correctly * 2 , possibly resulting in mcu runaway. 3. if an interrupt occurred during boot program execution, it would not be possible to execute the normal boot mode sequence. for these reasons, in on-board programming mode alone there are conditions for disabling interrupts, as an exception to the general rule. however, this provision does not guarantee normal erasing and programming or mcu operation. all interrupt requests, including nmi, must therefore be restricted inside and outside the mcu when programming or erasing flash memory. the nmi interrupt is also disabled in the error-protection state while the p or e bit remains set in flmcr1. notes: 1. interrupt requests must be disabled inside and outside the mcu until the programming control program has completed programming. 2. the vector may not be read correctly in this case for the following two reasons: ? if flash memory is read while being programmed or erased (while the p or e bit is set in flmcr1), correct read data will not be obtained (undetermined values will be returned). ? if the interrupt entry in the vector table has not been programmed yet, interrupt exception handling will not be executed correctly.
section 17 rom rev.7.00 feb. 14, 2007 page 608 of 1108 rej09b0089-0700 17.11 flash memory programmer mode 17.11.1 progremmer mode setting programs and data can be written and erased in programmer mode as well as in the on-board programming modes. in programmer mode, the on-chip rom can be freely programmed using a prom programmer * that supports the renesas technology microcomputer device type with 256- kbyte on-chip flash memory (fztat256v3a). flash memory read mode, auto-program mode, auto-erase mode, and status read mode are supported with this device type. in auto-program mode, auto-erase mode, and status read mode, a status polling procedure is used, and in status read mode, detailed internal signals are output after execution of an auto-program or auto-erase operation. note: * in the h8s/2315 f-ztat and h8s/2314 f-ztat, a prom programmer that supports the renesas technology microcomputer device type with 512-kbyte on-chip flash memory (fztat512v3a) is used. table 17.13 shows programmer mode pin settings. table 17.13 programmer mode pin settings pin names settings/external circuit connection mode pins: md2, md1, md0 low-level input mode setting pins: pf2, pf1, pf0 high-level input to pf2, low-level input to pf1 and pf0 fwe pin high-level input (in auto-program and auto-erase modes) stby pin high-level input (do not select hardware standby mode) nmi pin high-level input res pin reset circuit xtal, extal pins oscillator circuit other pins requiring setting: p23, p25 high-level input to p23, low-level input to p25
section 17 rom rev.7.00 feb. 14, 2007 page 609 of 1108 rej09b0089-0700 17.11.2 socket adapters and memory map in programmer mode, a socket adapter is connect ed to the chip as shown in figure 17.21. this enables the chip to fit a 40-pin socket. figure 17.20 shows the on-chip rom memory map and figure 17.21 shows the socket adapter pin assignments. h'00000000 mcu m ode address p ro g ra mm er m ode address h'0003ffff (h'000 5 ffff) * 1 (h'0001ffff) * 2 h'00000 h'3ffff (h' 5 ffff) * 1 (h'1ffff) * 2 o n- ch ip rom spa c e 2 56 k b y tes (384 k b y tes) * 1 (128 k b y tes) * 2 notes: 1. values in t h e h8 s /231 5 f-zt a t and h8 s /2314 f-zt a t. 2. values in t h e h8 s /2317 f-zt a t. figure 17.20 memory map in prom mode
section 17 rom rev.7.00 feb. 14, 2007 page 610 of 1108 rej09b0089-0700 h 8 s/ 2318 f- z tat, h 8 s/ 2317 f- z tat, h 8 s/ 231 5 f- z tat, h 8 s/ 231 4 f- z tat s o ck et a dapter ( 4 0 -pi n c on v ers i on) tfp- 100 b, tfp- 100 g fp- 100 a pi n n a m e 32 33 3 4 3 5 3 6 37 38 39 4 1 4 2 4 3 44 45 46 4 7 4 8 5 0 5 1 5 2 5 3 99 23 2 4 2 5 2 6 27 28 29 30 55 54 56 6 0 3 4 3 5 3 6 37 38 39 4 0 4 1 4 3 44 45 46 4 7 4 8 4 9 5 0 5 2 5 3 54 55 1 2 5 2 6 27 28 29 30 31 32 5 7 56 5 8 6 2 a 0 a 1 a 2 a 3 a 4 a 5 a 6 a 7 a 8 a 9 a 10 a 11 a 12 a 13 a 1 4 a 1 5 a 1 6 a 17 a 18 a 19 a 20 d 8 d 9 d 10 d 11 d 12 d 13 d 1 4 d 1 5 ce oe we fwe hn 27 c4 09 6hg ( 4 0 pi ns) pi n n o . pi n n a m e 21 22 23 2 4 2 5 2 6 27 28 29 31 32 33 3 4 3 5 3 6 37 38 39 10 9 8 19 18 17 1 6 1 5 1 4 13 12 2 20 3 4 1 , 4 0 11 , 30 5, 6, 7 a 0 a 1 a 2 a 3 a 4 a 5 a 6 a 7 a 8 a 9 a 10 a 11 a 12 a 13 a 1 4 a 1 5 a 1 6 a 17 a 18 a 19 a 20 i/o 0 i/o 1 i/o 2 i/o 3 i/o 4 i/o 5 i/o 6 i/o 7 ce oe we fwe v cc v ss nc 64 6 8 6 9 6 2 66 6 7 res xtal extal nc ( open ) 4 0 , 6 3 , 64, 65, 7 4, 77 , 78 , 98 , 5 9 4 2 , 65, 66, 6 7 , 7 6, 79 , 80 , 100 , 6 1 9 , 20 , 33 , 5 1 , 5 9 , 6 0 , 6 3 , 70 , 77 , 78 , 89 , 90 , 92 7 , 18 , 31 , 4 9 , 5 7 , 5 8 , 6 1 , 6 8 , , 7 5, 7 6, 87 , 88 , 90 v ss v cc r eset ci r c u i t o s cill at i on ci r c u i t * 1 * 2 l e g end : fwe: fl as h wr i te enab l e i/o 7 to i/o 0 : d ata i nput / output a 18 to a 0 : a ddress i nput ce : chi p enab l e oe : o utput enab l e we : w r i te enab l e n otes : thi s fig ure s h ows p i n ass ig n m ents , and does not s h ow t h e ent i re so ck et adapter ci r c u i t . 1 . a reset os cill at i on stab iliz at i on t im e (t os c 1 ) o f at l east 10 m s i s re q u i red . 2 . a 12 -mhz c r y sta l resonator s h ou l d be used . o t h er p i ns figure 17.21 h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, h8s/2314 f-ztat socket adapter pin assignments
section 17 rom rev.7.00 feb. 14, 2007 page 611 of 1108 rej09b0089-0700 17.11.3 programmer mode operation table 17.14 shows how the different operating modes are set when using programmer mode, and table 17.15 lists the commands used in programmer mode. details of each mode are given below. memory read mode: memory read mode supports byte reads. auto-program mode: auto-program mode supports programming of 128 bytes at a time. status polling is used to confirm the end of auto-programming. auto-erase mode: auto-erase mode supports automatic erasing of the entire flash memory. status polling is used to confirm the end of auto-erasing. status read mode: status polling is used for auto-programming and auto-erasing, and normal termination can be confirmed by reading the i/o 6 signal. in status read mode, error information is output if an error occurs.
section 17 rom rev.7.00 feb. 14, 2007 page 612 of 1108 rej09b0089-0700 table 17.14 settings for each opera ting mode in programmer mode pin names mode fwe ce oe we i/o 7 to i/o 0 a 18 to a 0 read h or l l l h data output ain output disable h or l l h h hi-z command write h or l * 3 l h l data input ain * 2 chip disable * 1 h or l h hi-z legend: h: high level l: low level hi-z: high impedance : don?t care notes: 1. chip disable is not a standby state; internally, it is an operation state. 2. ain indicates that there is also address input in auto-program mode. 3. for command writes when making a transition to auto-program or auto-erase mode, input a high level to the fwe pin. table 17.15 programmer mode commands 1st cycle 2nd cycle command name number of cycles mode address data mode address data memory read mode 1 + n write h'00 read ra dout auto-program mode 129 write h'40 write pa din auto-erase mode 2 write h'20 write h'20 status read mode 2 write h'71 write h'71 legend: ra: read address pa: program address : don?t care notes: 1. in auto-program mode, 129 cycles are required for command writing by a simultaneous 128-byte write. 2. in memory read mode, the number of cycles depends on the number of address write cycles (n).
section 17 rom rev.7.00 feb. 14, 2007 page 613 of 1108 rej09b0089-0700 17.11.4 memory read mode ? after the end of an auto-program, auto-erase, or status read operation, the command wait state is entered. to read memory contents, a transition must be made to memory read mode by means of a command write before the read is executed. ? command writes can be performed in memory read mode, just as in the command wait state. ? once memory read mode has been entered, consecutive reads can be performed. ? after power-on, memory read mode is entered. table 17.16 ac characteristics in memory read mode conditions: v cc = 3.3 v 0.3 v, v ss = 0 v, t a = 25c 5c item symbol min max unit command write cycle t nxtc 20 ? s ce hold time t ceh 0 ? ns ce setup time t ces 0 ? ns data hold time t dh 50 ? ns data setup time t ds 50 ? ns write pulse width t wep 70 ? ns we rise time t r ? 30 ns we fall time t f ? 30 ns c e a 18 to a 0 d ata h'00 o e w e c o mm and write t wep t c e h t d h t ds t f t r t n x t c note: d ata is lat ch ed at t h e risin g ed g e o f w e . t c es m e m or y read m ode a ddress stable d ata figure 17.22 memory read mode timing waveforms after command write
section 17 rom rev.7.00 feb. 14, 2007 page 614 of 1108 rej09b0089-0700 table 17.17 ac characteristics when entering another mode from memory read mode conditions: v cc = 3.3 v 0.3 v, v ss = 0 v, t a = 25c 5c item symbol min max unit command write cycle t nxtc 20 ? s ce hold time t ceh 0 ? ns ce setup time t ces 0 ? ns data hold time t dh 50 ? ns data setup time t ds 50 ? ns write pulse width t wep 70 ? ns we rise time t r ? 30 ns we fall time t f ? 30 ns c e a 18 to a 0 i/ o 7 to i/ o 0 o e w e o t h er m ode c o mm and write t c e h t ds t d h t f t r t n x t c note: d o not enable w e and o e at t h e sa m e ti m e. t c es t wep m e m or y read m ode a ddress stable figure 17.23 timing waveforms when entering another mode from memory read mode
section 17 rom rev.7.00 feb. 14, 2007 page 615 of 1108 rej09b0089-0700 table 17.18 ac characteristics in memory read mode conditions: v cc = 3.3 v 0.3 v, v ss = 0 v, t a = 25c 5c item symbol min max unit access time t acc ? 20 s ce output delay time t ce ? 150 ns oe output delay time t oe ? 150 ns output disable delay time t df ? 100 ns data output hold time t oh 5 ? ns c e a 18 to a 0 i/ o 7 to i/ o 0 o e w e vih vil vil t a cc t o h t o h t a cc a ddress stable a ddress stable figure 17.24 timing waveforms for ce / oe enable state read c e a 18 to a 0 i/ o 7 to i/ o 0 vih o e w e t c e t a cc t oe t o h t o h t d f t c e t a cc t oe a ddress stable a ddress stable t d f figure 17.25 timing waveforms for ce / oe clocked read
section 17 rom rev.7.00 feb. 14, 2007 page 616 of 1108 rej09b0089-0700 17.11.5 auto-program mode ? in auto-program mode, 128 bytes are programmed simultaneously. for this purpose, 128 consecutive byte data transfers should be performed. ? a 128-byte data transfer must be performed even if writing fewer than 128 bytes; in this case, h'ff data must be written to the extra addresses. ? the lower 7 bits of the transfer address must be held low. if an invalid address is input, memory programming will be started but a programming error will occur. ? memory address transfer is executed in the second cycle (figure 17.26). do not perform transfer later than the second cycle. ? do not perform a command write during a programming operation. ? perform one auto-programming operation for a 128-byte block for each address. one or more additional programming operations cannot be carried out on address blocks that have already been programmed. ? confirm normal end of auto-programming by checking i/o 6 . alternatively, status read mode can also be used for this purpose (the i/o 7 status polling pin is used to identify the end of an auto-program operation). ? status polling i/o 6 and i/o 7 information is retained until the next command write. as long as the next command write has not been performed, reading is possible by enabling ce and oe .
section 17 rom rev.7.00 feb. 14, 2007 page 617 of 1108 rej09b0089-0700 ac characteristics table 17.19 ac characteristics in auto-program mode conditions: v cc = 3.3 v 0.3 v, v ss = 0 v, t a = 25c 5c item symbol min max unit command write cycle t nxtc 20 ? s ce hold time t ceh 0 ? ns ce setup time t ces 0 ? ns data hold time t dh 50 ? ns data setup time t ds 50 ? ns write pulse width t wep 70 ? ns status polling start time t wsts 1 ? ms status polling access time t spa ? 150 ns address setup time t as 0 ? ns address hold time t ah 60 ? ns memory write time t write 1 3000 ms write setup time t pns 100 ? ns write end setup time t pnh 100 ? ns we rise time t r ? 30 ns we fall time t f ? 30 ns
section 17 rom rev.7.00 feb. 14, 2007 page 618 of 1108 rej09b0089-0700 a ddress stable c e f w e a 18 to a 0 i/ o 5 to i/ o 0 i/ o 6 i/ o 7 o e w e t as t a h t d h t ds t f t r t wep t wsts t write t spa t pns t pn h t n x t c t n x t c t c e h t c es p ro g ra mm in g operation end identi f i c ation si g nal d ata trans f er 1 b y te to 128 b y tes h'40 h'00 p ro g ra mm in g nor m al end identi f i c ation si g nal figure 17.26 auto-program mode timing waveforms 17.11.6 auto-erase mode ? auto-erase mode supports only total memory erasing. ? do not perform a command write during auto-erasing. ? confirm normal end of auto-erasing by checking i/o 6 . alternatively, status read mode can also be used for this purpose (the i/o 7 status polling pin is used to identify the end of an auto-erase operation). ? status polling i/o 6 and i/o 7 pin information is retained until the next command write. as long as the next command write has not been performed, reading is possible by enabling ce and oe .
section 17 rom rev.7.00 feb. 14, 2007 page 619 of 1108 rej09b0089-0700 ac characteristics table 17.20 ac characteristics in auto-erase mode conditions: v cc = 3.3 v 0.3 v, v ss = 0 v, t a = 25c 5c item symbol min max unit command write cycle t nxtc 20 ? s ce hold time t ceh 0 ? ns ce setup time t ces 0 ? ns data hold time t dh 50 ? ns data setup time t ds 50 ? ns write pulse width t wep 70 ? ns status polling start time t ests 1 ? ms status polling access time t spa ? 150 ns memory erase time t erase 100 40000 ms erase setup time t ens 100 ? ns erase end setup time t enh 100 ? ns we rise time t r ? 30 ns we fall time t f ? 30 ns c e f w e a 18 to a 0 i/ o 5 to i/ o 0 i/ o 6 i/ o 7 o e w e t ests t erase t spa t d h t ds t f t r t wep t ens t en h t n x t c t n x t c t c e h t c es erase end identi f i- c ation si g nal erase nor m al end c on f ir m ation si g nal h'20 h'20 h'00 figure 17.27 auto-erase mode timing waveforms
section 17 rom rev.7.00 feb. 14, 2007 page 620 of 1108 rej09b0089-0700 17.11.7 status read mode ? status read mode is used to identify what ty pe of abnormal end has occurred. use this mode when an abnormal end occurs in auto-program mode or auto-erase mode. ? the return code is retained until a command write for other than status read mode is performed. table 17.21 ac characteristics in status read mode conditions: v cc = 3.3 v 0.3 v, v ss = 0 v, t a = 25c 5c item symbol min max unit command write cycle t nxtc 20 ? s ce hold time t ceh 0 ? ns ce setup time t ces 0 ? ns data hold time t dh 50 ? ns data setup time t ds 50 ? ns write pulse width t wep 70 ? ns oe output delay time t oe ? 150 ns disable delay time t df ? 100 ns ce output delay time t ce ? 150 ns we rise time t r ? 30 ns we fall time t f ? 30 ns c e a 18 to a 0 i/ o 7 to i/ o 0 o e w e t d h t d f t ds t f t r t wep t n x t c t n x t c t f t r t wep t ds t d h t n x t c t c e h t c e h t oe t c es t c es t c e h'71 h'71 note: i/ o 3 and i/ o 2 are unde f ined. figure 17.28 status read mode timing waveforms
section 17 rom rev.7.00 feb. 14, 2007 page 621 of 1108 rej09b0089-0700 table 17.22 status read mode return commands pin name i/o 7 i/o 6 i/o 5 i/o 4 i/o 3 i/o 2 i/o 1 i/o 0 attribute normal end identification command error program- ming error erase error ? ? program- ming or erase count exceeded effective address error initial value 0 0 0 0 0 0 0 0 indications normal end: 0 abnormal end: 1 command error: 1 otherwise: 0 program- ming error: 1 otherwise: 0 erase error: 1 otherwise: 0 ? ? count exceeded: 1 otherwise: 0 effective address error: 1 otherwise: 0 note: i/o 3 and i/o 2 are undefined. 17.11.8 status polling ? the i/o 7 status polling flag indicates the operating status in auto-program or auto-erase mode. ? the i/o 6 status polling flag indicates a normal or ab normal end in auto-program or auto-erase mode. table 17.23 status polling output truth table pin names internal operation in progress abnormal end ? normal end i/o 7 0 1 0 1 i/o 6 0 0 1 1 i/o 0 to i/o 5 0 0 0 0
section 17 rom rev.7.00 feb. 14, 2007 page 622 of 1108 rej09b0089-0700 17.11.9 programmer mode transition time commands cannot be accepted during the oscillation stabilization period or the progremmer mode setup period. after the progremmer mode setup time, a transition is made to memory read mode. table 17.24 command wait state transition time specifications item symbol min max unit standby release (oscillation stabilization time) t osc1 30 ? ms programmer mode setup time t bmv 10 ? ms v cc hold time t dwn 0 ? ms v cc r e s f w e m e m or y read m ode c o mm and wait state c o mm and wait state nor m al/ abnor m al end identi f i c ation a uto-pro g ra m m ode a uto-erase m ode t os c 1 t b mv t dwn note: e xc ept in auto-pro g ra m m ode and auto-erase m ode , dri v e t h e f w e input pin low. figure 17.29 oscillation stabilization time, programmer mode setup time, and power supply fall sequence
section 17 rom rev.7.00 feb. 14, 2007 page 623 of 1108 rej09b0089-0700 17.11.10 notes on memory programming ? when programming addresses which have previously been programmed, carry out auto- erasing before auto-programming. ? when performing programming using prom mode on a chip that has been programmed/erased in an on-board programming mode, auto-erasing is recommended before carrying out auto-programming. notes: 1. the flash memory is initially in the erased state when the device is shipped by renesas technology. for other chips for which the erasure history is unknown, it is recommended that auto-erasing be executed to check and supplement the initialization (erase) level. 2. auto-programming should be performed once only on the same address block. additional programming cannot be carried out on address blocks that have already been programmed. 17.12 flash memory programming and erasing precautions precautions concerning the use of on-board programming mode, the ram emulation function, and prom mode are summarized below. use the specified voltages and timing for programming and erasing: applied voltages in excess of the rating can permanently damage the device. use a prom programmer that supports the renesas technology microcomputer device type with 256-kbyte on-chip flash memory (fztat256v3a) or the renesas technology microcomputer device type with 512-kbyte on-chip flash memory (fztat512v3a). do not select the hn27c4096 setting for the prom programmer, and only use the specified socket adapter. failure to observe these points may result in damage to the device. powering on and off (see figures 17.30 to 17.32): do not apply a high level to the fwe pin until v cc has stabilized. also, drive the fwe pin low before turning off v cc . when applying or disconnecting v cc power, fix the fwe pin low and place the flash memory in the hardware protection state. the power-on and power-off timing requirements should also be satisfied in the event of a power failure and subsequent recovery.
section 17 rom rev.7.00 feb. 14, 2007 page 624 of 1108 rej09b0089-0700 fwe application/disconnection (see figures 17.30 to 17.32): fwe application should be carried out when mcu operation is in a stable condition. if mcu operation is not stable, fix the fwe pin low and set the protection state. the following points must be observed concerning fwe application and disconnection to prevent unintentional programming or erasing of flash memory: ? apply fwe when the v cc voltage has stabilized within its rated voltage range. apply fwe when oscillation has stabilized (after the elapse of the oscillation stabilization time). ? in boot mode, apply and disconnect fwe during a reset. ? in user program mode, fwe can be switched between high and low level regardless of the reset state. fwe input can also be switched during execution of a program in flash memory. ? do not apply fwe if program runaway has occurred. ? disconnect fwe only when the swe, esu, psu, ev, pv, p, and e bits in flmcr1 are cleared. make sure that the swe, esu, psu, ev, pv, p, and e bits are not set by mistake when applying or disconnecting fwe. do not apply a constant high level to the fwe pin: apply a high level to the fwe pin only when programming or erasing flash memory. a system configuration in which a high level is constantly applied to the fwe pin should be avoided. also, while a high level is applied to the fwe pin, the watchdog timer should be activated to prevent overprogramming or overerasing due to program runaway, etc. use the recommended algorithm when pr ogramming and erasing flash memory: the recommended algorithm enables programming and er asing to be carried out without subjecting the device to voltage stress or sacrificing program data reliability. when setting the p or e bit in flmcr1, the watchdog timer should be set beforehand as a precaution against program runaway, etc. do not set or clear the swe bit during execution of a program in flash memory: wait for at least 100 s after clearing the swe bit before executi ng a program or reading data in flash memory. when the swe bit is set, data in flash memory can be rewritten, but when swe = 1, flash memory can only be read in program-verify or erase-verify mode. access flash memory only for verify operations (verification during programming/erasing). also, do not clear the swe bit during programming, erasing, or verifying. similarly, when using the ram emulation function while a high level is being input to the fwe pin, the swe bit must be cleared before executing a program or reading data in flash memory.
section 17 rom rev.7.00 feb. 14, 2007 page 625 of 1108 rej09b0089-0700 however, the ram area overlapping flash memory space can be read and written to regardless of whether the swe bit is set or cleared. do not use interrupts while flash memory is being programmed or erased: all interrupt requests, including nmi, should be disabled during fwe application to give priority to program/erase operations. do not perform additional programming. erase the memory before reprogramming: in on- board programming, perform only one programming operation on a 128-byte programming unit block. in prom mode, too, perform only one programming operation on a 128-byte programming unit block. programming should be carried out with the entire programming unit block erased. before programming, check that the chip is correctly mounted in the prom programmer: overcurrent damage to the device can result if the index marks on the prom programmer socket, socket adapter, and chip are not correctly aligned. do not touch the socket adapter or chip during programming: touching either of these can cause contact faults and write errors.
section 17 rom rev.7.00 feb. 14, 2007 page 626 of 1108 rej09b0089-0700 p eriod durin g w h i ch f las h m e m or y a cc ess is pro h ibited ( x : w ait ti m e a f ter settin g sw e bit) * 2 p eriod durin g w h i ch f las h m e m or y c an be pro g ra mm ed (e x e c ution o f pro g ra m in f las h m e m or y pro h ibited , and data reads ot h er t h an v eri fy operations pro h ibited) v cc f w e t osc 1 m in 0 s m in 0 s t mds * 3 t mds * 3 md 2 to md 0 * 1 r e s sw e bit sw e set sw e c leared p ro g ra mm in g / erasin g possible w ait ti m e: xw ait ti m e: 100 s notes: 1. e xc ept w h en swit ch in g m odes , t h e le v el o f t h e m ode pins ( md 2 to md 0) m ust be f i x ed until power-o ff b y pullin g t h e pins up or down. 2. s ee se c tion 20.3. 6, flas h m e m or y ch ara c teristi c s. 3. m ode pro g ra mm in g setup ti m e t mds ( m in) = 200 ns figure 17.30 power-on/off timing (boot mode)
section 17 rom rev.7.00 feb. 14, 2007 page 627 of 1108 rej09b0089-0700 sw e set sw e c leared v cc f w e t osc 1 m in 0 s md 2 to md 0 * 1 r e s sw e bit p ro g ra mm in g / erasin g possible w ait ti m e: xw ait ti m e: 100 s t mds * 3 p eriod durin g w h i ch f las h m e m or y a cc ess is pro h ibited ( x : w ait ti m e a f ter settin g sw e bit) * 2 p eriod durin g w h i ch f las h m e m or y c an be pro g ra mm ed (e x e c ution o f pro g ra m in f las h m e m or y pro h ibited , and data reads ot h er t h an v eri fy operations pro h ibited) notes: 1. e xc ept w h en swit ch in g m odes , t h e le v el o f t h e m ode pins ( md 2 to md 0) m ust be f i x ed until power-o ff b y pullin g t h e pins up or down. 2. s ee se c tion 20.3. 6, flas h m e m or y ch ara c teristi c s. 3. m ode pro g ra mm in g setup ti m e t mds ( m in) = 200 ns figure 17.31 power-on/off timing (user program mode)
section 17 rom rev.7.00 feb. 14, 2007 page 628 of 1108 rej09b0089-0700 p eriod durin g w h i ch f las h m e m or y a cc ess is pro h ibited ( x : w ait ti m e a f ter settin g sw e bit) * 3 p eriod durin g w h i ch f las h m e m or y c an be pro g ra mm ed (e x e c ution o f pro g ra m in f las h m e m or y pro h ibited , and data reads ot h er t h an v eri fy operations pro h ibited) v cc f w e t osc 1 m in 0 s t mds t mds t mds * 2 t r e sw md 2 to md 0 r e s sw e bit m ode ch an g e * 1 m ode ch an g e * 1 b oot m ode u ser m ode u ser pro g ra m m ode sw e set sw e c leared p ro g ra mm in g /erasin g possible w ait ti m e: x w ait ti m e: 100 s p ro g ra mm in g /erasin g possible w ait ti m e: x w ait ti m e: 100 s p ro g ra mm in g /erasin g possible w ait ti m e: x w ait ti m e: 100 s p ro g ra mm in g /erasin g possible w ait ti m e: x w ait ti m e: 100 s u ser m ode u ser pro g ra m m ode notes: 1. wh en enterin g boot m ode or m a k in g a transition f ro m boot m ode to anot h er m ode , m ode swit ch in g m ust be c arried out b y m eans o f r e s input. t h e state o f ports wit h m ultiple x ed address f un c tions and bus c ontrol output pins ( a s , r d , wr ) will ch an g e durin g t h is swit ch o v er inter v al (t h e inter v al durin g w h i ch t h e r e s pin input is low) , and t h ere f ore t h ese pins s h ould not be used as output si g nals durin g t h is ti m e. 2. wh en m a k in g a transition f ro m boot m ode to anot h er m ode , a m ode pro g ra mm in g setup ti m e t mds ( m in) o f 200 ns is ne c essar y wit h respe c t to r e s c learan c e ti m in g . 3. s ee se c tion 20.3. 6, flas h m e m or y ch ara c teristi c s. figure 17.32 mode transition timing (example: boot mode user mode ? user program mode)
section 17 rom rev.7.00 feb. 14, 2007 page 629 of 1108 rej09b0089-0700 17.13 overview of flash memory (h8s/2319 f-ztat) 17.13.1 features the h8s/2319 f-ztat has 512 kbytes of on-chip flash memory. the features of the flash memory are summarized below. ? four flash memory operating modes ? program mode ? erase mode ? program-verify mode ? erase-verify mode ? programming/erase methods the flash memory is programmed 128 bytes at a time. erasing is performed by block erase (in single-block units). to erase the entire flash memory, the individual blocks must be erased sequentially. block erasing can be performed as required on 4-kbyte, 32-kbyte, and 64-kbyte blocks. ? programming/erase times the flash memory programming time is 10.0 ms (typ.) for simultaneous 128-byte programming, equivalent to 78 s (typ.) per byte, and the erase time is 50 ms (typ.). ? reprogramming capability the flash memory can be reprogrammed a minimum of 100 times. ? on-board programming modes there are two modes in which flash memory can be programmed/erased/verified on-board: ? boot mode ? user program mode ? automatic bit rate adjustment with data transfer in boot mode, the bit rate of the chip can be automatically adjusted to match the transfer bit rate of the host. ? flash memory emulation by ram part of the ram area can be overlapped onto flash memory, to emulate flash memory updates in real time. ? protect modes there are three protect modes, hardware, soft ware, and error protect, which allow protected status to be designated for flash memory program/erase/verify operations.
section 17 rom rev.7.00 feb. 14, 2007 page 630 of 1108 rej09b0089-0700 ? programmer mode flash memory can be programmed/erased in programmer mode, using a prom programmer, as well as in on-board programming mode. 17.13.2 overview block diagram module bus bus interface/controller flash memory (512 kbytes) operating mode ebr1 internal address bus internal data bus (16 bits) mode pin ebr2 syscr2 flmcr2 flmcr1 ramer legend: flmcr1: flash memory control register 1 flmcr2: flash memory control register 2 ebr1: erase block register 1 ebr2: erase block register 2 ramer: ram emulation register syscr2: system control register 2 figure 17.33 block diagram of flash memory
section 17 rom rev.7.00 feb. 14, 2007 page 631 of 1108 rej09b0089-0700 17.13.3 flash memory operating modes mode transitions: when the mode pins are set in the reset state and a reset-start is executed, the chip enters one of the operating modes shown in figure 17.34. in user mode, flash memory can be read but not programmed or erased. flash memory can be programmed and erased in boot mode, user program mode, and prom mode. boot mode on - board programm i ng mode u ser program mode u ser mode (on - ch i p rom enab l ed) reset state p rogrammer mode res = 0 s we = 1 s we = 0 * n otes : on l y make a trans i t i on bet w een user mode and user program mode w hen the c pu i s not access i ng the f l ash memory . * m d 2 = m d 1 = m d0 = 0, pf 2 = 1 , pf 1 = 0, pf0 = 0 res = 0 res = 0 res = 0 m d 1 = 1 , m d 2 = 1 m d 1 = 1 , m d 2 = 0 figure 17.34 flash memory mode transitions
section 17 rom rev.7.00 feb. 14, 2007 page 632 of 1108 rej09b0089-0700 17.13.4 on-board programming modes ? boot mode fl ash memory ch i p ram h ost p rogramm i ng contro l program sc i app li cat i on program (o l d v ers i on) n e w app li cat i on program fl ash memory ch i p ram h ost sc i app li cat i on program (o l d v ers i on) boot program area n e w app li cat i on program fl ash memory ch i p ram h ost sc i fl ash memory pre w r i te - erase boot program n e w app li cat i on program fl ash memory ch i p p rogram e x ecut i on state ram h ost sc i n e w app li cat i on program boot program p rogramm i ng contro l program 1 . i n i t i a l state t he o l d program v ers i on or data rema i ns w r i tten i n the f l ash memory . t he user shou l d prepare the programm i ng contro l program and ne w app li cat i on program beforehand i n the host . 2 . p rogramm i ng contro l program transfer w hen boot mode i s entered , the boot program i n the ch i p (or i g i na ll y i ncorporated i n the ch i p) i s started and the programm i ng contro l program i n the host i s transferred to ram vi a sc i commun i cat i on . t he boot program re q u i red for f l ash memory eras i ng i s automat i ca ll y transferred to the ram boot program area . 3. fl ash memory i n i t i a liz at i on t he erase program i n the boot program area ( i n ram) i s e x ecuted , and the f l ash memory i s i n i t i a liz ed (to h'ff ) . i n boot mode , ent i re f l ash memory erasure i s performed , wi thout regard to b l ocks . 4. w r i t i ng ne w app li cat i on program t he programm i ng contro l program transferred from the host to ram i s e x ecuted , and the ne w app li cat i on program i n the host i s w r i tten i nto the f l ash memory . p rogramm i ng contro l program boot program boot program boot program area boot program area p rogramm i ng contro l program figure 17.35 boot mode
section 17 rom rev.7.00 feb. 14, 2007 page 633 of 1108 rej09b0089-0700 ? user program mode fl ash memory ch i p ram h ost p rogramm i ng / erase contro l program sc i boot program n e w app li cat i on program fl ash memory ch i p ram h ost sc i n e w app li cat i on program fl ash memory ch i p ram h ost sc i fl ash memory erase boot program n e w app li cat i on program fl ash memory ch i p p rogram e x ecut i on state ram h ost sc i boot program boot program app li cat i on program (o l d v ers i on) n e w app li cat i on program 1 . i n i t i a l state (1) t he program that will transfer the programm i ng / erase contro l program to on - ch i p ram shou l d be w r i tten i nto the f l ash memory by the user beforehand . (2) t he programm i ng / erase contro l program shou l d be prepared i n the host or i n the f l ash memory . 2 . p rogramm i ng / erase contro l program transfer ex ecutes the transfer program i n the f l ash memory , and transfers the programm i ng / erase contro l program to ram . 3. fl ash memory i n i t i a liz at i on t he programm i ng / erase program i n ram i s e x ecuted , and the f l ash memory i s i n i t i a liz ed (to h'ff ) . e ras i ng can be performed i n b l ock un i ts , but not i n byte un i ts . 4. w r i t i ng ne w app li cat i on program n e x t , the ne w app li cat i on program i n the host i s w r i tten i nto the erased f l ash memory b l ocks . d o not w r i te to unerased b l ocks . p rogramm i ng / erase contro l program p rogramm i ng / erase contro l program p rogramm i ng / erase contro l program app li cat i on program (o l d v ers i on) t ransfer program t ransfer program t ransfer program t ransfer program figure 17.36 user program mode (example)
section 17 rom rev.7.00 feb. 14, 2007 page 634 of 1108 rej09b0089-0700 17.13.5 flash memory emulation in ram reading overlap ram data in user mode and user program mode: emulation should be performed in user mode or user program mode. when the emulation block set in ramer is accessed while the emulation function is being executed, data written in the overlap ram is read. app li cat i on program ex ecut i on state fl ash memory e mu l at i on b l ock ram sc i o v er l ap ram (emu l at i on i s performed on data w r i tten i n ram) figure 17.37 reading overlap ram data in user mode and user program mode
section 17 rom rev.7.00 feb. 14, 2007 page 635 of 1108 rej09b0089-0700 writing overlap ram data in user program mode: when overlap ram data is confirmed, the rams bit is cleared, ram overlap is released, and writes should actually be performed to the flash memory. when the programming control program is transferred to ram, ensure that the transfer destination and the overlap ram do not overlap, as this will cause data in the overlap ram to be rewritten. app li cat i on program fl ash memory ram sc i o v er l ap ram (programm i ng data) p rogramm i ng data p rogramm i ng contro l program ex ecut i on state figure 17.38 writing overlap ram data in user program mode 17.13.6 differences between boot mode and user program mode table 17.25 differences between boot mode and user program mode boot mode user program mode entire memory erase yes yes block erase no yes programming control program * program/program-verify erase/erase-verify/program/ program-verify/emulation note: * to be provided by the user, in accordance with the recommended algorithm.
section 17 rom rev.7.00 feb. 14, 2007 page 636 of 1108 rej09b0089-0700 17.13.7 block configuration the flash memory is divided into seven 64-kbyte blocks, one 32-kbyte block, and eight 4-kbyte blocks. address h' 000000 a ddress h' 0 7ffff 4 kbytes 8 3 2 kbytes 64 kbytes 64 kbytes 64 kbytes 64 kbytes 64 kbytes 64 kbytes 64 kbytes 512 kbytes figure 17.39 flash memory block configuration
section 17 rom rev.7.00 feb. 14, 2007 page 637 of 1108 rej09b0089-0700 17.13.8 pin configuration the flash memory is controlled by means of the pins shown in table 17.26. table 17.26 flash memory pins pin name abbreviation i/o function reset res input reset mode 2 md2 input sets mcu operating mode mode 1 md1 input sets mcu operating mode mode 0 md0 input sets mcu operating mode port pf2 pf2 input sets mcu operating mode in programmer mode port pf1 pf1 input sets mcu operating mode in programmer mode port pf0 pf0 input sets mcu operating mode in programmer mode transmit data txd1 output serial transmit data output receive data rxd1 input serial receive data input
section 17 rom rev.7.00 feb. 14, 2007 page 638 of 1108 rej09b0089-0700 17.13.9 register configuration the registers used to control the on-chip flash memory when enabled are shown in table 17.27. in order to access the flmcr1, flmcr2, ebr1, and ebr2 registers, the flshe bit must be set to 1 in syscr2 (except ramer). table 17.27 flash memory registers register name abbreviation r/w initial value address * 1 flash memory control register 1 flmcr1 * 6 r/w * 3 h'80 h'ffc8 * 2 flash memory control register 2 flmcr2 * 6 r/w * 3 h'00 h'ffc9 * 2 erase block register 1 ebr1 * 6 r/w * 3 h'00 * 4 h'ffca * 2 erase block register 2 ebr2 * 6 r/w * 3 h'00 * 5 h'ffcb * 2 system control register 2 syscr2 * 7 r/w h'00 h'ff42 ram emulation register ramer r/w h'00 h'fedb notes: 1. lower 16 bits of the address. 2. flash memory. registers selection is performed by the flshe bit in system control register 2 (syscr2). 3. in modes in which the on-chip flash memory is disabled, a read will return h'00, and writes are invalid. 4. if a high level is input and the swe bit in flmcr1 is not set, these registers are initialized to h'00. 5. bits 3 to 0 are initialized to 0 when the swe1 bit in flmcr1 is not set, and bits 7 to 4 are initialized to 0 when the swe2 bit in flmcr2 is not set. 6. flmcr1, flmcr2, ebr1, and ebr2 are 8-bit registers. only byte accesses are valid for these registers, the access requiring 2 states. 7. the syscr2 register can only be used in the f-ztat version. in the mask rom version this register will return an undefined value if read, and cannot be modified.
section 17 rom rev.7.00 feb. 14, 2007 page 639 of 1108 rej09b0089-0700 17.14 register descriptions 17.14.1 flash memory control register 1 (flmcr1) bit : 7 6 5 4 3 2 1 0 fwe1 swe1 esu1 psu1 ev1 pv1 e1 p1 initial value : 1 0 0 0 0 0 0 0 r/w : r r/w r/w r/w r/w r/w r/w r/w flmcr1 is an 8-bit register used for flash memory operating mode control. program-verify mode or erase-verify mode for addresses h'000000 to h'03ffff is entered by setting swe1 to 1 then setting the ev1 or pv1 bit. program mode for addresses h'000000 to h'03ffff is entered by setting swe1 to 1 then setting the psu1 bit, and finally setting the p1 bit. erase mode for addresses h'000000 to h' 03ffff is entered by setting swe1 to 1 then setting the esu1 bit, and finally setting the e1 bit. flmcr1 is initialized to h'80 by a reset, and in hardware standby mode and software standby mode. when on-chip flash memory is disabled, a read will return h'00, and writes are invalid. writes to bits esu1, psu1, ev1, and pv1 only when swe1 = 1; writes to the e1 bit only when swe1 = 1, and esu1 = 1; and writes to the p1 bit only when swe1 = 1, and psu1 = 1. bit 7?flash write enable bit (fwe): sets hardware protection against flash memory programming/erasing. this bit cannot be modified and is always read as 1 in this model. bit 6?software write enable bit 1 (swe1): enables or disables flash memory programming and erasing for addresses h'000000 to h'03ffff. this bit should be set when setting flmcr1 bits 5 to 0, ebr1 bits 7 to 0, and ebr2 bits 3 to 0. when swe1 = 1, the flash memory can only be read in program-verify or erase-verify mode. bit 6 swe1 description 0 writes disabled (initial value) 1 writes enabled
section 17 rom rev.7.00 feb. 14, 2007 page 640 of 1108 rej09b0089-0700 bit 5?erase setup bit 1 (esu1): prepares for a transition to erase mode for addresses h'000000 to h'03ffff. do not set the swe1, psu1, ev1, pv1, e1, or p1 bit at the same time. bit 5 esu1 description 0 erase setup cleared (initial value) 1 erase setup [setting condition] when swe1 = 1 bit 4?program setup bit 1 (psu1): prepares for a transition to program mode for addresses h'000000 to h'03 ffff. do not set the swe1, esu1, ev1, pv 1, e1, or p1 bit at the same time. bit 4 psu1 description 0 program setup cleared (initial value) 1 program setup [setting condition] when swe1 = 1 bit 3?erase-verify 1 (ev1): selects erase-verify mode transition or clearing for addresses h'000000 to h'03 ffff. do not set the swe1, esu1, psu1, pv 1, e1, or p1 bit at the same time. bit 3 ev1 description 0 erase-verify mode cleared (initial value) 1 transition to erase-verify mode [setting condition] when swe1 = 1
section 17 rom rev.7.00 feb. 14, 2007 page 641 of 1108 rej09b0089-0700 bit 2?program-verify 1 (pv1): selects program-verify mode transition or clearing for addresses h'000000 to h'03ffff. do not set the swe1, esu1, psu1, ev1, e1, or p1 bit at the same time. bit 2 pv1 description 0 program-verify mode cleared (initial value) 1 transition to program-verify mode [setting condition] when swe1 = 1 bit 1?erase 1 (e1): selects erase mode transition or clearing for addresses h'000000 to h'03ffff. do not set the swe1, esu1, psu1, ev1, pv1, or p1 bit at the same time. bit 1 e1 description 0 erase mode cleared (initial value) 1 transition to erase mode [setting condition] when swe1 = 1, and esu1 = 1 bit 0?program 1 (p1): selects program mode transition or clearing for addresses h'000000 to h'03ffff. do not set the swe1, psu1, esu1, ev1, pv1, or e1 bit at the same time. bit 0 p1 description 0 program mode cleared (initial value) 1 transition to program mode [setting condition] when swe1 = 1, and psu1 = 1
section 17 rom rev.7.00 feb. 14, 2007 page 642 of 1108 rej09b0089-0700 17.14.2 flash memory control register 2 (flmcr2) bit : 7 6 5 4 3 2 1 0 fler swe2 esu2 psu2 ev2 pv2 e2 p2 initial value : 0 0 0 0 0 0 0 0 r/w : r r/w r/w r/w r/w r/w r/w r/w flmcr2 is an 8-bit register used for flash memory operating mode control. program-verify mode or erase-verify mode for addresses h'040000 to h'07ffff is entered by setting swe2 to 1 then setting the ev2 or pv2 bit. program mode for addresses h'040000 to h'07ffff is entered by setting swe2 to 1 then setting the psu2 bit, and finally setting the p2 bit. erase mode for addresses h'040000 to h' 07ffff is entered by setting swe2 to 1 then setting the esu2 bit, and finally setting the e2 bit. flmcr2 is initialized to h'00 by a reset, and in hardware standby mode and software standby mode. when on-chip flash memory is disabled, a read will return h'00, and writes are invalid. writes to bits esu2, psu2, ev2, and pv2 only when swe2 = 1; writes to the e2 bit only when swe2 = 1, and esu2 = 1; and writes to the p2 bit only when swe2 = 1, and psu2 = 1. bit 7?flash memory error (fler): indicates that an error has occurred during an operation on flash memory (programming or erasing). when fler is set to 1, flash memory goes to the error- protection state. bit 7 fler description 0 flash memory is operating normally (initial value) flash memory program/erase protection (error protection) is disabled [clearing condition] reset or hardware standby mode 1 an error has occurred during flash memory programming/erasing flash memory program/erase protection (error protection) is enabled [setting condition] see section 17.17.3, error protection bit 6?software write enable bit 2 (swe2): enables or disables flash memory programming and erasing for addresses h'040000 to h'07ffff. this bit should be set when setting flmcr2 bits 5 to 0, and ebr2 bits 7 to 4. when swe2 = 1, the flash memory can only be read in program-verify or erase-verify mode.
section 17 rom rev.7.00 feb. 14, 2007 page 643 of 1108 rej09b0089-0700 bit 6 swe2 description 0 writes disabled (initial value) 1 writes enabled bit 5?erase setup bit 2 (esu2): prepares for a transition to erase mode for addresses h'040000 to h'07ffff. do not set the swe2, psu2, ev2, pv2, e2, or p2 bit at the same time. bit 5 esu2 description 0 erase setup cleared (initial value) 1 erase setup [setting condition] when swe2 = 1 bit 4?program setup bit 2 (psu2): prepares for a transition to program mode for addresses h'040000 to h'07 ffff. do not set the swe2, esu2, ev2, pv 2, e2, or p2 bit at the same time. bit 4 psu2 description 0 program setup cleared (initial value) 1 program setup [setting condition] when swe2 = 1 bit 3?erase-verify 2 (ev2): selects erase-verify mode transition or clearing for addresses h'040000 to h'07 ffff. do not set the swe2, esu2, psu2, pv 2, e2, or p2 bit at the same time. bit 3 ev2 description 0 erase-verify mode cleared (initial value) 1 transition to erase-verify mode [setting condition] when swe2 = 1
section 17 rom rev.7.00 feb. 14, 2007 page 644 of 1108 rej09b0089-0700 bit 2?program-verify 2 (pv2): selects program-verify mode transition or clearing for addresses h'040000 to h'07ffff. do not set the swe2, esu2, psu2, ev2, e2, or p2 bit at the same time. bit 2 pv2 description 0 program-verify mode cleared (initial value) 1 transition to program-verify mode [setting condition] when swe2 = 1 bit 1?erase 2 (e2): selects erase mode transition or clearing for addresses h'040000 to h'07ffff. do not set the swe2, esu2, psu2, ev2, pv2, or p2 bit at the same time. bit 1 e2 description 0 erase mode cleared (initial value) 1 transition to erase mode [setting condition] when swe2 = 1, and esu2 = 1 bit 0?program 2 (p2): selects program mode transition or clearing for h'040000 to h'07ffff. do not set the swe2, psu2 , esu2, ev2, pv2, or e2 bit at the same time. bit 0 p2 description 0 program mode cleared (initial value) 1 transition to program mode [setting condition] when swe2 = 1, and psu2 = 1
section 17 rom rev.7.00 feb. 14, 2007 page 645 of 1108 rej09b0089-0700 17.14.3 erase block register 1 (ebr1) bit : 7 6 5 4 3 2 1 0 ebr1 eb7 eb6 eb5 eb4 eb3 eb2 eb1 eb0 initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w ebr1 is an 8-bit register that specifies the flash memory erase area block by block. ebr1 is initialized to h'00 by a reset, in hardware standby mode and software standby mode, and the swe1 bit in flmcr1 is not set. when a bit in ebr1 is set, the corresponding block can be erased. other blocks are erase-protected. set only one bit in ebr1 and ebr2 together (setting more than one bit will automatically clear all ebr1 and ebr2 bits to 0). when on-chip flash memory is disabled, a read will return h'00 and writes are invalid. the flash memory block configuration is shown in table 17.28.
section 17 rom rev.7.00 feb. 14, 2007 page 646 of 1108 rej09b0089-0700 17.14.4 erase block register 2 (ebr2) bit : 7 6 5 4 3 2 1 0 ebr2 eb15 eb14 eb13 eb12 eb11 eb10 eb9 eb8 initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w ebr2 is an 8-bit register that specifies the flash memory erase area block by block. ebr2 is initialized to h'00 by a reset, in hardware standby mode and software standby mode, and when the swe1 bit in flmcr1 is not set. when a bit in ebr2 is set, the corresponding block can be erased. other blocks are erase-protected. set only one bit in ebr2 and ebr1 together (setting more than one bit will automatically clear all ebr1 and ebr2 bits to 0). when on-chip flash memory is disabled, a read will return h'00, and writes are invalid. the flash memory block configuration is shown in table 17.28. table 17.28 flash memory erase blocks block (size) address eb0 (4 kbytes) h'000000 to h'000fff eb1 (4 kbytes) h'001000 to h'001fff eb2 (4 kbytes) h'002000 to h'002fff eb3 (4 kbytes) h'003000 to h'003fff eb4 (4 kbytes) h'004000 to h'004fff eb5 (4 kbytes) h'005000 to h'005fff eb6 (4 kbytes) h'006000 to h'006fff eb7 (4 kbytes) h'007000 to h'007fff eb8 (32 kbytes) h'008000 to h'00ffff eb9 (64 kbytes) h'010000 to h'01ffff eb10 (64 kbytes) h'020000 to h'02ffff eb11 (64 kbytes) h'030000 to h'03ffff eb12 (64 kbytes) h'040000 to h'04ffff eb13 (64 kbytes) h'050000 to h'05ffff eb14 (64 kbytes) h'060000 to h'06ffff eb15 (64 kbytes) h'070000 to h'07ffff
section 17 rom rev.7.00 feb. 14, 2007 page 647 of 1108 rej09b0089-0700 17.14.5 system control register 2 (syscr2) bit : 7 6 5 4 3 2 1 0 ? ? ? ? flshe ? ? ? initial value : 0 0 0 0 0 0 0 0 r/w : ? ? ? ? r/w ? ? r/w syscr2 is an 8-bit readable/writable register that performs on-chip flash memory control. syscr2 is initialized to h'00 by a reset and in hardware standby mode. syscr2 can only be used in the f-ztat version. in the mask rom version this register will return an undefined value if read, and cannot be modified. bits 7 to 4?reserved: these bits cannot be modified and are always read as 0. bit 3?flash memory control register enable (flshe): controls cpu access to the flash memory control registers (flmcr1, flmcr2, ebr1, and ebr2). writing 1 to the flshe bit enables the flash memory control registers to be read and written to. clearing flshe to 0 designates these registers as unselected (the register contents are retained). bit 3 flshe description 0 flash control registers are not selected for addresses h'ffffc8 to h'ffffcb (initial value) 1 flash control registers are selected for addresses h'ffffc8 to h'ffffcb bits 2 and 1?reserved: these bits cannot be modified and are always read as 0. bit 0?reserved: only 0 should be written. 17.14.6 ram emulation register (ramer) bit : 7 6 5 4 3 2 1 0 ? ? ? ? rams ram2 ram1 ram0 initial value : 0 0 0 0 0 0 0 0 r/w : ? ? ? ? r/w r/w r/w r/w ramer specifies the area of flash memory to be overlapped with part of ram when emulating real-time flash memory programming. ramer is initialized to h'00 by a reset and in hardware
section 17 rom rev.7.00 feb. 14, 2007 page 648 of 1108 rej09b0089-0700 standby mode. it is not initialized in software standby mode. ramer settings should be made in user mode or user program mode. flash memory area divisions are shown in table 17.29. to ensure correct operation of the emulation function, the rom for which ram emulation is performed should not be accessed immediately after this register has been modified. normal execution of an access immediately after register modification is not guaranteed. bits 7 to 4?reserved: these bits cannot be modified and are always read as 0. bit 3?ram select (rams): specifies selection or non-selection of flash memory emulation in ram. when rams = 1, all flash memory blocks are program/erase-protected. bit 3 rams description 0 emulation not selected (initial value) program/erase-protection of all flash memory blocks is disabled 1 emulation selected program/erase-protection of all flash memory blocks is enabled bits 2 to 0?flash memory area selection (ram2 to ram0): these bits are used together with bit 3 to select the flash memory area to be overlapped with ram (see table 17.29). table 17.29 flash memory area divisions ram area block name rams ram2 ram1 ram0 h'ffdc00 to h'ffebff ram area, 4 kbytes 0 h'000000 to h'000fff eb0 (4 kbytes) 1 0 0 0 h'001000 to h'001fff eb1 (4 kbytes) 1 0 0 1 h'002000 to h'002fff eb2 (4 kbytes) 1 0 1 0 h'003000 to h'003fff eb3 (4 kbytes) 1 0 1 1 h'004000 to h'004fff eb4 (4 kbytes) 1 1 0 0 h'005000 to h'005fff eb5 (4 kbytes) 1 1 0 1 h'006000 to h'006fff eb6 (4 kbytes) 1 1 1 0 h'007000 to h'007fff eb7 (4 kbytes) 1 1 1 1 : don?t care
section 17 rom rev.7.00 feb. 14, 2007 page 649 of 1108 rej09b0089-0700 17.15 on-board programming modes when pins are set to on-board programming mode, program/erase/verify operations can be performed on the on-chip flash memory. there are two on-board programming modes: boot mode and user program mode. the pin settings for transition to each of these modes are shown in table 17.30. for a diagram of the transitions to the various flash memory modes, see figure 17.34. table 17.30 setting on-board programming modes modes pins mcu mode cpu operating mode md2 md1 md0 boot mode advanced expanded mode with on-chip rom enabled 0 1 0 advanced single-chip mode 1 user program mode * advanced expanded mode with on-chip rom enabled 1 1 0 advanced single-chip mode 1 note: * normally, user mode should be used. set the swe bit to 1 to make a transition to user program mode before performing a program/erase/verify operation.
section 17 rom rev.7.00 feb. 14, 2007 page 650 of 1108 rej09b0089-0700 17.15.1 boot mode when boot mode is used, the flash memory programming control program must be prepared in the host beforehand. the channel 1 sci to be used is set to asynchronous mode. when a reset-start is executed after the h8s/2319 f-ztat chip?s pins have been set to boot mode, the boot program built into the chip is started and the programming control program prepared in the host is serially transmitted to the chip via the sci. in the chip, the programming control program received via the sci is written into the programming control program area in on-chip ram. after the transfer is completed, control br anches to the start address of the programming control program area and the programming control program execution state is entered (flash memory programming is performed). the transferred programming control program must therefore include coding that follows the programming algorithm given later. the system configuration in boot mode is shown in figure 17.40, and the boot program mode execution procedure in figure 17.41. r xd 1 t xd 1 sci1 chip flash memory w rite data reception verify data transmission host on-chip ram figure 17.40 system configuration in boot mode
section 17 rom rev.7.00 feb. 14, 2007 page 651 of 1108 rej09b0089-0700 note: if a memory cell does not operate normally and cannot be erased , one h'ff byte is transmitted as an erase error , and the erase operation and subse q uent operations are halted. start set pins to boot mode and e x ecute reset-start host transfers data (h' 00 ) continuously at prescribed bit rate chip measures lo w period of h' 00 data transmitted by host chip calculates bit rate and sets v alue in bit rate register after bit rate adjustment , chip transmits one h' 00 data byte to host to indicate end of adjustment host confirms normal reception of bit rate adjustment end indication (h' 00 ) , and transmits one h'55 data byte after recei v ing h'55 , chip transmits one h'aa data byte to host host transmits number of programming control program bytes (n) , upper byte follo w ed by lo w er byte chip transmits recei v ed number of bytes to host as v erify data (echo-back) n = 1 host transmits programming control program se q uentially in byte units chip transmits recei v ed programming control program to host as v erify data (echo-back) transfer recei v ed programming control program to on-chip ram n = n? no yes end of transmission check flash memory data , and if data has already been w ritten , erase all blocks after confirming that all flash memory data has been erased , chip transmits one h'aa data byte to host e x ecute programming control program transferred to on-chip ram n + 1 n figure 17.41 boot mode execution procedure
section 17 rom rev.7.00 feb. 14, 2007 page 652 of 1108 rej09b0089-0700 automatic sci bit rate adjustment: when boot mode is initiated, the h8s/2319 f-ztat chip measures the low period of the asynchronous sci communication data (h'00) transmitted continuously from the host. the sci transmit/receive format should be set as follows: 8-bit data, 1 stop bit, no parity. the chip calculates the bit rate of the transmission from the host from the measured low period, and transmits one h'00 byte to the host to indicate the end of bit rate adjustment. the host should confirm that this adjustment end indication (h'00) has been received normally, and transmit one h'55 byte to the ch ip. if reception cannot be performed normally, initiate boot mode again (reset), and repeat the above operations. depending on the host?s transmission bit rate and the chip?s system clock frequency, there will be a discrepancy between the bit rates of the host and the chip. to ensure correct sci operation, the host?s transfer bit rate should be set to 9,600 or 19,200 bps. table 17.31 shows typical host transfer bit rates and system clock frequencies for which automatic adjustment of the mcu?s bit rate is possible. the boot program should be executed within this system clock range. start bit stop bit d0 d 1 d 2 d3 d 4 d 5 d 6 d 7 lo w period (9 bits) measured (h' 00 data) high period (1 or more bits ) figure 17.42 automatic sci bit rate adjustment table 17.31 system clock frequencies for which automatic adjustment of h8s/2319 f-ztat bit rate is possible host bit rate system clock frequency for which automatic adjustment of h8s/2319 f-ztat bit rate is possible 19,200 bps 16 mhz to 25 mhz 9,600 bps 8 mhz to 25 mhz
section 17 rom rev.7.00 feb. 14, 2007 page 653 of 1108 rej09b0089-0700 on-chip ram area divisions in boot mode: in boot mode, the 2-kbyte area from h'ffdc00 to h'ffe3ff is reserved for use by the boot program, as shown in figure 17.43. the area to which the programming control program is transferred is h'ffe400 to h'fffbff. the boot program area can be used when the programming control program transferred into ram enters the execution state. a stack area should be set up as required. h'ff d c 00 h'ffe 3 ff p rogramming control program area (6 kbytes) h'fffbff boot program area * (2 kbytes) note: * the boot program area cannot be used until a transition is made to the e x ecution state for the programming control program transferred to ram. note that the boot program remains stored in this area after a branch is made to the programming control program. figure 17.43 ram areas in boot mode notes on use of boot mode ? when the chip comes out of reset in boot mode, it measures the low-level period of the input at the sci?s rxd1 pin. the reset should end with rxd1 high. after the reset ends, it takes approximately 100 states before the chip is ready to measure the low-level period of the rxd1 pin. ? in boot mode, if any data has been programmed into the flash memory (if all data is not 1), all flash memory blocks are erased. boot mode is for use when user program mode is unavailable, such as the first time on-board programming is performed, or if the program activated in user program mode is accidentally erased. ? interrupts cannot be used while the flash memory is being programmed or erased.
section 17 rom rev.7.00 feb. 14, 2007 page 654 of 1108 rej09b0089-0700 ? the rxd1 and txd1 pins should be pulled up on the board. ? before branching to the programming control program (ram area h'ffe400 to h'fffbff), the chip terminates transmit and receive operations by the on-chip sci (channel 1) (by clearing the re and te bits in scr to 0), but the adjusted bit rate value remains set in brr. the transmit data output pin, txd1, goes to the high-level output state (p31ddr = 1, p31dr = 1). the contents of the cpu?s internal general registers are undefined at this time, so these registers must be initialized immediately after branching to the programming control program. in particular, since the stack pointer (sp) is used implicitly in subroutine calls, etc., a stack area must be specified for use by the programming control program. initial settings must also be made for the other on-chip registers. ? boot mode can be entered by making the pin settings shown in table 17.30 and executing a reset-start. boot mode can be cleared by driving the reset pin low, waiting at least 20 states, then setting the mode pins, and executing reset release * 1 . boot mode can also be cleared by a wdt overflow reset. do not change the mode pin input levels in boot mode. ? if the mode pin input levels are changed (for example, from low to high) during a reset, the state of ports with multiplexed address functions and bus control output pins ( as , rd , hwr ) will change according to the change in the microcomputer?s operating mode * 2 . therefore, care must be taken to make pin settings to prevent these pins from becoming output signal pins during a reset, or to prevent collision with signals outside the microcomputer. notes: 1. mode pins input must satisfy the mode programming setup time (t mds = 200 ns) with respect to the reset release timing. 2. see section 8, i/o ports. 17.15.2 user program mode when set to user program mode, the chip can program and erase its flash memory by executing a user program/erase control program. therefore, on-board reprogramming of the on-chip flash memory can be carried out by providing an on-board means to supply programming data, and storing a program/erase control program in part of the program area if necessary. to select user program mode, select a mode that enables the on-chip flash memory (mode 6 or 7). in this mode, on-chip supporting modules other than flash memory operate as they normally would in modes 6 and 7.
section 17 rom rev.7.00 feb. 14, 2007 page 655 of 1108 rej09b0089-0700 while the swe1 bit is set to 1 to perform programming or erasing for the addresses h'000000 to h'03ffff, this address area cannot be read. while the swe2 bit is set to 1 to perform programming or erasing for the addresses h' 040000 to h'07 ffff, this address area cannot be read. the control program that performs programming and erasing should be run in on-chip ram or flash memory except for the above address ar eas. when the program is located in external memory, an instruction for programming the flash memory and the following instruction should be located in on-chip ram. figure 17.44 shows the procedure for executing the program/erase control program when transferred to on-chip ram. branch to flash memory application program branch to program/erase control program in ram area e x ecute program/erase control program (flash memory re w riting) transfer program/erase control program to ram m d 2 , m d 1 , m d0 = 11 0, 111 reset-start w rite transfer program (and the program/erase control program if necessary) beforehand note: the w atchdog timer should be acti v ated to pre v ent o v erprogramming or o v ererasing due to program runa w ay , etc. figure 17.44 user program mode execution procedure
section 17 rom rev.7.00 feb. 14, 2007 page 656 of 1108 rej09b0089-0700 17.16 programming/erasing flash memory in the on-board programming modes, flash memory programming and erasing is performed by software, using the cpu. there are four flash memory operating modes: program mode, erase mode, program-verify mode, and erase-verify mode. transition to these modes can be made for addresses h'000000 to h'03 ffff by setting the psu1, esu1, p1 , e1, pv1, and ev1 bits in flmcr1, and for addresses h'040000 to h'07ffff by setting the psu2, esu2, p2, e2, pv2, and ev2 bits in flmcr2. the flash memory cannot be read while being programmed or erased. therefore, the program that controls flash memory programming/erasing (the programming control program) should be located and executed in on-chip ram, external memory, or flash memory except for the above address areas. when the program is located in external memory, an instruction for programming the flash memory and the following instruction should be located in on-chip ram. the dtc should not be activated before or after the instruction for programming the flash memory is executed. notes: 1. operation is not guaranteed if setting/resetting of the swe1, esu1, psu1, ev1, pv1, e1, and p1 bits in flmcr1 or setting/resetting of the swe2, esu2, psu2, ev2, pv2, e2, and p2 bits in flmcr2 is executed by a program in flash memory. 2. perform programming in the erased state. do not perform additional programming on previously programmed addresses. 3. do not program addresses h' 000000 to h'03 ffff and h' 040000 to h'07ffff simultaneously. operation is not guaranteed when programming is performed simultaneously. 17.16.1 program mode (n = 1 for addresses h'000000 to h'03ffff, and n = 2 for addresses h'040000 to h'07ffff) follow the procedure shown in the program/program-verify flowchart in figure 17.45 to write data or programs to flash memory. performing program operations according to this flowchart will enable data or programs to be written to flash memory without subjecting the device to voltage stress or sacrificing program data reliability. programming should be carried out 128 bytes at a time. for the wait times (x, y, z1, z2, z3 , ?, , , , and ) after bits are set or cleared in flash memory control register n (flmcrn) and the maximum number of programming operations (n), see section 20.3.6, flash memory characteristics. following the elapse of (x) s or more after the swen bit is set to 1 in flash memory control register n (flmcrn), 128-byte program data is stored in the program data area and reprogram
section 17 rom rev.7.00 feb. 14, 2007 page 657 of 1108 rej09b0089-0700 data area, and the 128-byte data in the reprogram data area is written consecutively to the write addresses. the lower 8 bits of the first address written to must be h'00 or h'80. the 128 consecutive byte data transfers are performed. the program address and program data are latched in the flash memory. a 128-byte data transfer must be performed even if writing fewer than 128 bytes; in this case, h'ff data must be written to the extra addresses. next, the watchdog timer is set to prevent overprogramming in the event of program runaway, etc. set a value greater than (y + z2 + + ) s as the wdt overflow period. after this, preparation for program mode (program setup) is carried out by setting the psun bit in flmcrn, and after the elapse of (y) s or more, the operating mode is switched to program mode by setting the pn bit in flmcrn. the time during which the pn bit is set is the flash memory programming time. set the programming time according to the table in the programming flowchart. 17.16.2 program-verify mode (n = 1 for addresses h'000000 to h'03ffff, and n = 2 for addresses h'040000 to h'07ffff) in program-verify mode, the data written in program mode is read to check whether it has been correctly written in the flash memory. after the elapse of a given programming time, the programming mode is exited (the pn bit in flmcrn is cleared to 0, then the ps un bit is cleared to 0 at least ( ) s later). next, the watchdog timer is cleared after the elapse of ( ) s or more, and the operating mode is switched to program-verify mode by setting the pvn bit in flmcrn. before reading in program-verify mode, a dummy write of h'ff data should be made to the addresses to be read. the dummy write should be executed after the elapse of ( ) s or more. when the flash memory is read in this state (verify data is read in 16-bit units), the data at the latched address is read. wait at least ( ) s after the dummy write before performing this read operation. next, the originally written data is compared with the verify data, and reprogram data is computed (see figure 17.45) and transferred to the reprogram data area. after 128 bytes of data have been verified, exit program-verify mode and wait for at least ( ) s, then clear the swen bit in flmcrn to 0, and wait again for at least ( ) s. if reprogramming is necessary, set program mode again, and repeat the program/program- verify sequence as before. however, ensure that the program/program-verify sequence is not repeated more than (n) times on the same bits.
section 17 rom rev.7.00 feb. 14, 2007 page 658 of 1108 rej09b0089-0700 start end of programming end sub set s w e1 (2) bit in flmcr1 (2) w ait ( x ) s n = 1 m = 0 sub-routine-call see note *7 for pulse w idth note: 7. w rite p ulse w idth start of programming sub-routine w rite pulse set p s u 1 (2) bit in flmcr1 (2) enable wd t set p 1 (2) bit in flmcr1 (2) w ait (y) s clear p 1 (2) bit in flmcr1 (2) w ait ( z 1) s or ( z 2) s or ( z3 ) s clear p s u 1 (2) bit in flmcr1 (2) w ait ( ) s d isable wd t w ait ( ) s w rite pulse application subroutine ng ng ng ng ng ng ok ok ok ok ok w ait ( ) s w ait ( ) s * 2 * 4 * 6 * 6 * 6 * 6 * 6 * 6 * 6 * 6 * 5 * 6 * 6 * 6 * 6 * 6 * 1 set p v1 (2) bit in flmcr1 (2) h'ff dummy w rite to v erify address read v erify data additional program data computation transfer additional program data to additional program data area read data = v erify data? * 4 * 1 * 4 * 3 reprogram data computation clear p v1 (2) bit in flmcr1 (2) clear s w e1 (2) bit in flmcr1 (2) m = 1 128-byte data v erification completed? m = 0 ? 6 n ? 6 n ? increment address p rogramming failure ok clear s w e1 (2) bit in flmcr1 (2) n n? reprogram d ata (x') 0 1 verify d ata (v) 0 1 0 1 additional p rogram d ata (y) 0 1 comments additional programming e x ecuted additional programming not e x ecuted additional programming not e x ecuted additional programming not e x ecuted additional p rogram d ata operation chart w rite 128-byte data in ram reprogram data area consecuti v ely to flash memory w rite pulse ( z 1) s or ( z 2) s ram p rogram data area (128 bytes) reprogram data area (128 bytes) additional program data area (128 bytes) store 128-byte program data in program data area and reprogram data area number of w rites (n) 1 2 3 4 5 6 7 8 9 1 0 11 12 1 3 . . . 998 999 1 000 w rite time ( z ) s z 1 z 1 z 1 z 1 z 1 z 1 z 2 z 2 z 2 z 2 z 2 z 2 z 2 . . . z 2 z 2 z 2 notes: 1. d ata transfer is performed by byte transfer. the lo w er 8 bits of the first address w ritten to must be h' 00 or h'8 0 . a 128-byte data transfer must be performed e v en if w riting fe w er than 128 bytes; in this case , h'ff data must be w ritten to the e x tra addresses. 2. verify data is read in 16-bit ( w ) units. 3 . e v en bits for w hich programming has been completed in the 128-byte programming loop w ill be subjected to additional programming if they fail the subse q uent v erify operation. 4. a 128-byte area for storing program data , a 128-byte area for storing reprogram data , and a 128-byte area for storing additional program data should be pro v ided in ram. the contents of the reprogram data and additional program data areas are modified as programming proceeds. 5. a w rite pulse of ( z 1) or ( z 2) s should be applied according to the progress of programming. see note * 7 for the pulse w idths. w hen the additional program data is programmed , a w rite pulse of ( z3 ) s should be applied. reprogram data x' stands for reprogram data to w hich a w rite pulse has been applied. 6. for the v alues of x, y , z 1 , z 2 , z3, , , , , , , and n , see section 2 0 . 3 .6 , flash memory characteristics. original d ata ( d ) 0 1 verify d ata (v) 0 1 0 1 reprogram d ata (x) 1 0 1 comments p rogramming completed p rogramming incomplete; reprogram still in erased state; no action p rogram d ata operation chart transfer reprogram data to reprogram data area n n + 1 note: u se a ( z3 ) s w rite pulse for additional programming. se q uentially w rite 128-byte data in additional program data area in ram to flash memory w rite p ulse ( z3 ) s additional w rite pulse w ait ( ) s w ait ( ) s w ait ( ) s p erform programming in the erased state. d o not perform additional programming on pre v iously programmed addresses. figure 17.45 program/program-verify flowchart
section 17 rom rev.7.00 feb. 14, 2007 page 659 of 1108 rej09b0089-0700 17.16.3 erase mode (n = 1 for addresses h'000000 to h'03ffff, and n = 2 for addresses h'040000 to h'07ffff) flash memory erasing should be performed block by block following the procedure shown in the erase/erase-verify flowchart (single-block erase) shown in figure 17.46. for the wait times (x, y, z, , ?, , , , ) after bits are set or cleared in flash memory control register n (flmcrn) and the maximum number of programming operations (n), see section 20.3.6, flash memory characteristics. to perform data or program erasure, make a 1 bit setting for the flash memory area to be erased in erase block register 1 or 2 (ebr1 or ebr2) at least (x) s after setting the swen bit to 1 in flash memory control register n (flmcrn). next, the watchdog timer is set to prevent overerasing in the event of program runaway, etc. set a value greater than (y + z + + ?) ms as the wdt overflow period. after this, preparation for erase mode (erase setup) is carried out by setting the esun bit in flmcrn, and after the elapse of (y) s or more, the operating mode is switched to erase mode by setting the en bit in flmcrn. the time during which the en bit is set is the flash memory erase time. ensure that the erase time does not exceed (z) ms. note: with flash memory erasing, prewriting (setting all data in the memory to be erased to 0) is not necessary before starting the erase procedure.
section 17 rom rev.7.00 feb. 14, 2007 page 660 of 1108 rej09b0089-0700 17.16.4 erase-verify mode (n = 1 for addresses h'000000 to h'03ffff, and n = 2 for addresses h'040000 to h'07ffff) in erase-verify mode, data is read after memory has been erased to check whether it has been correctly erased. after the elapse of the erase time, erase mode is ex ited (the en bit in flmcrn is cleared to 0, then the esun bit in flmcrn is cleared to 0 at least ( ) s later), the watchdog timer is cleared after the elapse of ( ) s or more, and the operating mode is switched to erase-verify mode by setting the evn bit in flmcrn. before reading in erase-verify mode, a dummy write of h'ff data should be made to the addresses to be read. the dummy write should be executed after the elapse of ( ) s or more. when the flash memory is read in this state (verify data is read in 16-bit units), the data at the latched address is read. wait at least ( ) s after the dummy write before performing this read operation. if the read data has been eras ed (all 1), a dummy write is performed to the next address, and erase-verify is performed. if the read data has not been erased, set erase mode again, and repeat the erase/erase-verify sequence in the same way. however, ensure that the erase/erase- verify sequence is not repeated more than (n) times. when verification is completed, exit erase- verify mode, and wait for at least ( ) s. if erasure has been completed on all the erase blocks, clear the swen bit in flmcrn to 0 and wait for at least ( ) s. if there are any unerased blocks, make a 1 bit setting for the flash memory area to be erased, and repeat the erase/erase-verify sequence in the same way.
section 17 rom rev.7.00 feb. 14, 2007 page 661 of 1108 rej09b0089-0700 end of erasing start set s w e1 (2) bit in flmcr1 (2) set es u 1 (2) bit in flmcr1 (2) set e1 (2) bit in flmcr1 (2) w ait ( x ) s w ait (y) s n = 1 set ebr1 , ebr2 enable wd t * 2 * 2 * 4 w ait ( z ) ms * 2 w ait ( ) s * 2 w ait ( ) s * 2 w ait ( ) s set block start address to v erify address * 2 w ait ( ) s * 2 * 3 * 2 w ait ( ) s * 2 * 2 * 5 start of erase clear e1 (2) bit in flmcr1(2) clear es u 1 (2) bit in flmcr1 (2) set ev1 (2) bit in flmcr1 (2) h'ff dummy w rite to v erify address read v erify data clear ev1 (2) bit in flmcr1 (2) w ait ( ) s clear ev1 (2) bit in flmcr1 (2) clear s w e1 (2) bit in flmcr1 (2) d isable wd t halt erase * 1 verify data = all 1? last address of block? end of erasing of all erase blocks? erase failure clear s w e1 (2) bit in flmcr1 (2) n n? ng ng ng ng ok ok ok ok n n + 1 increment address notes: 1. p re w riting (setting erase block data to all 0 ) is not necessary. 2. the v alues of x, y , z, , , , , , , and n are sho w n in section 2 0 . 3 .6 , flash memory characteristics. 3 . verify data is read in 16-bit ( w ) units. 4. set only one bit in ebr1or ebr2. more than one bit cannot be set. 5. erasing is performed in block units. to erase a number of blocks , the indi v idual blocks must be erased se q uentially. w ait ( ) s w ait ( ) s figure 17.46 erase/er ase-verify flowchart
section 17 rom rev.7.00 feb. 14, 2007 page 662 of 1108 rej09b0089-0700 17.17 flash memory protection there are three kinds of flash memory program/erase protection: hardware protection, software protection, and error protection. 17.17.1 hardware protection hardware protection refers to a state in which programming/erasing of flash memory is forcibly disabled or aborted. settings in flash memory control registers 1 and 2 (flmcr1, flmcr2) and erase block registers 1 and 2 (ebr1, ebr2) are reset (see table 17.32). table 17.32 hardware protection functions item description program erase reset/standby protection ? in a reset (including a wdt overflow reset) and in standby mode, flmcr1, flmcr2, ebr1, and ebr2 are initialized, and the program/erase-protected state is entered. ? in a reset via the res pin, the reset state is not entered unless the res pin is held low until oscillation stabilizes after powering on. in the case of a reset during operation, hold the res pin low for the res pulse width specified in section 20.3.3, ac characteristics. yes yes
section 17 rom rev.7.00 feb. 14, 2007 page 663 of 1108 rej09b0089-0700 17.17.2 software protection software protection can be implemented by setting the swe1 bit in flash memory control register 1 (flmcr1), swe2 bit in flmcr2 erase block registers 1 and 2 (ebr1, ebr2), and the rams bit in the ram emulation register (ramer). when software protection is in effect, setting the p1 or e1 bit in flmcr1, or the p2 or e2 bit in flmcr2 does not cause a transition to program mode or erase mode (see table 17.33). table 17.33 software protection functions item description program erase swe bit protection ? clearing the swe1 bit to 0 in flmcr1 sets the program/erase-protected state for area h'000000 to h'03ffff (execute in on-chip ram, external memory, or addresses h'040000 to h'07ffff) ? clearing the swe2 bit to 0 in flmcr2 sets the program/erase-protected state for area h'040000 to h'07ffff (execute in on-chip ram, external memory, or addresses h'000000 to h'03ffff) yes yes block specification protection ? erase protection can be set for individual blocks by settings in erase block registers 1 and 2 (ebr1, ebr2). ? setting ebr1 and ebr2 to h'00 places all blocks in the erase-protected state. ? yes emulation protection ? setting the rams bit to 1 in the ram emulation register (ramer) places all blocks in the program/erase-protected state. yes yes
section 17 rom rev.7.00 feb. 14, 2007 page 664 of 1108 rej09b0089-0700 17.17.3 error protection in error protection, an error is detected wh en mcu runaway occurs during flash memory programming/erasing, or operation is not performed in accordance with the program/erase algorithm, and the program/erase operation is aborted. aborting the program/erase operation prevents damage to the flash memory due to overprogramming or overerasing. if the mcu malfunctions during flash memory programming/erasing, the fler bit is set to 1 in flmcr2 and the error protection state is entered. the flmcr1, flmcr2, ebr1, and ebr2 settings are retained, but program mode or erase mode is aborted at the point at which the error occurred. program mode or erase mode cannot be re-entered by re-setting the p1, p2, e1, or e2 bit. however, pv1, pv2, ev1, and ev2 bit setting is enabled, and a transition can be made to verify mode. fler bit setting conditions are as follows: ? when flash memory is read during programming/erasing (including a vector read or instruction fetch) ? immediately after exception handling (excluding a reset) during programming/erasing ? when a sleep instruction (including software standby) is executed during programming/erasing ? when a bus master other than the cpu (the dtc) has control of the bus during programming/erasing error protection is released only by a reset and in hardware standby mode. figure 17.47 shows the flash memory state transition diagram.
section 17 rom rev.7.00 feb. 14, 2007 page 665 of 1108 rej09b0089-0700 r d vf p r er fler = 0 error occurrence r e s = 0 or s tby = 0 r e s = 0 or s tby = 0 r d vf p r e r fler = 0 normal operating mode p rogram mode erase mode reset or hard w are standby (hard w are protection) r d vf p r e r fler = 1 r d vf p r e r fler = 1 error protection mode error protection mode (soft w are standby) soft w are standby mode flmcr1 , flmcr2 (e x cept fler bit) , ebr1 , ebr2 initiali z ation state flmcr1 , flmcr2 , ebr1 , ebr2 initiali z ation state soft w are standby mode release r d : memory read possible vf: verify-read possible p r: p rogramming possible er: erasing possible r d : memory read not possible vf : verify-read not possible p r : p rogramming not possible e r : erasing not possible legend: r e s = 0 or s tby = 0 error occurrence (soft w are standby) figure 17.47 flash memory state transitions
section 17 rom rev.7.00 feb. 14, 2007 page 666 of 1108 rej09b0089-0700 17.18 flash memory emulation in ram 17.18.1 emulation in ram making a setting in the ram emulation register (ramer) enables part of ram to be overlapped onto the flash memory area so that data to be written to flash memory can be emulated in ram in real time. after the ramer setting has been made, accesses can be made from the flash memory area or the ram area overlapping flash memory. emulation can be performed in user mode and user program mode. figure 17.48 shows an example of emulation of real-time flash memory programming. start of emulation program end of emulation program tuning ok? yes no set ramer w rite tuning data to o v erlap ram e x ecute application program clear ramer w rite to flash memory emulation block figure 17.48 flowchart for flash memory emulation in ram
section 17 rom rev.7.00 feb. 14, 2007 page 667 of 1108 rej09b0089-0700 17.18.2 ram overlap an example in which flash memory block area eb1 is overlapped is shown below. h' 000000 h' 00 1 000 h' 00 2 000 h' 030000 h' 00 4 000 h' 00 5 000 h' 00 6 000 h' 00 7 000 h' 00 8 000 h' 0 7ffff flash memory eb8 to eb15 this area can be accessed from both the ram area and flash memory area eb 0 eb1 eb2 eb 3 eb4 eb5 eb6 eb7 h'ff d c 00 h'ffebff h'fffbff on-chip ram figure 17.49 example of ram overlap operation example in which flash memory block area eb1 is overlapped 1. set bits rams, ram2, ram1, and ram0 in ramer to 1, 0, 0, 1, to overlap part of ram onto the area (eb1) for which real-time programming is required. 2. real-time programming is performed using the overlapping ram. 3. after the program data has been confirmed, the rams bit is cleared, releasing ram overlap. 4. the data written in the overlapping ram is written into the flash memory space (eb1). notes: 1. when the rams bit is set to 1, program/erase protection is enabled for all blocks regardless of the value of ram2, ram1, and ram0 (emulation protection). in this state, setting the p1 or e1 bit in flash memory control register 1 (flmcr1), or setting
section 17 rom rev.7.00 feb. 14, 2007 page 668 of 1108 rej09b0089-0700 the p2 or e2 bit in flmcr2 will not cause a transition to program mode or erase mode. when actually programming a flash memory area, the rams bit should be cleared to 0. 2. a ram area cannot be erased by execution of software in accordance with the erase algorithm while flash memory emulation in ram is being used. 3. block area eb0 includes the vector table. when performing ram emulation, the vector table is needed by the overlap ram. 17.19 interrupt handling when programming/erasing flash memory all interrupts, including nmi input, are disabled when flash memory is being programmed or erased (when the p1 or e1 bit is set in flmcr1, or the p2 or e2 bit is set in flmcr2), and while the boot program is executing in boot mode * 1 , to give priority to the program or erase operation. there are three reasons for this: 1. interrupt during programming or erasing might cause a violation of the programming or erasing algorithm, with the result that normal operation could not be assured. 2. in the interrupt exception handling sequence during programming or erasing, the vector would not be read correctly * 2 , possibly resulting in mcu runaway. 3. if an interrupt occurred during boot program execution, it would not be possible to execute the normal boot mode sequence. for these reasons, in on-board programming mode alone there are conditions for disabling interrupts, as an exception to the general rule. however, this provision does not guarantee normal erasing and programming or mcu operation. all requests, including nmi, must therefore be restricted inside and outside the mcu when programming or erasing flash memory. the nmi interrupt is also disabled in the error-protection state while the p1 or e1 bit remains set in flmcr1, or the p2 or e2 bit remains set in flmcr2. notes: 1. interrupt requests must be disabled inside and outside the mcu until the programming control program has completed programming. 2. the vector may not be read correctly in this case for the following two reasons: ? if flash memory is read while being programmed or erased (while the p1 or e1 bit is set in flmcr1, or the p2 or e2 bit is set in flmcr2), correct read data will not be obtained (undetermined values will be returned). ? if the interrupt entry in the vector table has not been programmed yet, interrupt exception handling will not be executed correctly.
section 17 rom rev.7.00 feb. 14, 2007 page 669 of 1108 rej09b0089-0700 17.20 flash memory programmer mode 17.20.1 programmer mode setting programs and data can be written and erased in programmer mode as well as in the on-board programming modes. in programmer mode, the on-chip rom can be freely programmed using a prom programmer that supports the renesas technology microcomputer device type with 512- kbyte on-chip flash memory (fztat512v3a). flash memory read mode, auto-program mode, auto-erase mode, and status read mode are supported with this device type. in auto-program mode, auto-erase mode, and status read mode, a status polling procedure is used, and in status read mode, detailed internal signals are output after execution of an auto-program or auto-erase operation. table 17.34 shows programmer mode pin settings. table 17.34 programmer mode pin settings pin names settings/external circuit connection mode pins: md2, md1, md0 low-level input mode setting pins: pf2, pf1, pf0 high-level input to pf2, low-level input to pf1 and pf0 stby pin high-level input (do not select hardware standby mode) res pin reset circuit xtal, extal pins oscillator circuit other pins requiring setting: p23, p25 high-level input to p23, low-level input to p25
section 17 rom rev.7.00 feb. 14, 2007 page 670 of 1108 rej09b0089-0700 17.20.2 socket adapters and memory map in programmer mode, a socket adapter is connect ed to the chip as shown in figure 17.51. this enables the chip to fit a 40-pin socket. figure 17.50 shows the on-chip rom memory map and figure 17.51 shows the socket adapter pin assignments. h' 00000000 mc u mode address p rogrammer mode address h' 000 7ffff h' 00000 h'7ffff on-chip rom space (512 kbytes) figure 17.50 memory map in programmer mode
section 17 rom rev.7.00 feb. 14, 2007 page 671 of 1108 rej09b0089-0700 h 8s / 2 3 19 f-zt a t socket adapter ( 40-pi n con v ers i on) tfp- 1 00 b fp- 1 00 a pi n n ame 3 2 33 34 3 5 3 6 3 7 3 8 3 9 4 1 4 2 43 44 4 5 4 6 4 7 4 8 5 0 51 52 5 3 99 2 3 2 4 25 26 27 28 29 30 55 5 4 56 6 0 34 3 5 3 6 3 7 3 8 3 9 40 4 1 43 44 4 5 4 6 4 7 4 8 4 9 5 0 52 5 3 5 4 55 1 25 26 27 28 29 30 3 1 3 2 57 56 58 62 a 0 a 1 a 2 a 3 a 4 a 5 a 6 a 7 a 8 a 9 a 1 0 a 11 a 12 a 1 3 a 1 4 a 15 a 16 a 17 a 18 a 19 a 2 0 d 8 d 9 d 1 0 d 11 d 12 d 1 3 d 1 4 d 15 ce oe we e m le * 3 hn 27c 40 96 h g ( 40 pi ns) pi n n o . pi n n ame 21 22 2 3 2 4 25 26 27 28 29 3 1 3 2 33 34 3 5 3 6 3 7 3 8 3 9 1 0 9 8 19 18 17 16 15 1 4 1 3 12 2 2 0 3 4 1 , 40 11 , 30 5 , 6 , 7 a 0 a 1 a 2 a 3 a 4 a 5 a 6 a 7 a 8 a 9 a 1 0 a 11 a 12 a 1 3 a 1 4 a 15 a 16 a 17 a 18 a 19 a 2 0 i/ o 0 i/ o 1 i/ o 2 i/ o 3 i/ o 4 i/ o 5 i/ o 6 i/ o 7 ce oe we fwe v cc v ss n c 6 4 68 69 62 66 67 res x t a l e x t a l n c (o pen ) 40, 6 3, 6 4, 65 , 7 4, 77 , 78 , 98 , 59 4 2 , 65 , 66 , 67 , 76 , 79 , 8 0, 1 00, 61 9 , 2 0, 33, 51 , 59 , 6 0, 6 3, 7 0, 77 , 78 , 89 , 9 0, 92 7 , 18 , 3 1 , 4 9 , 57 , 58 , 61 , 68 , , 75 , 76 , 87 , 88 , 9 0 v ss v cc reset c i rcu i t osc ill at i on c i rcu i t * 1 * 2 l egend : e m le: e mu l at i on enab l e i/ o 7 to i/ o 0 : d ata i nput / output a 18 to a 0 : address i nput ce : ch i p enab l e oe : output enab l e we : w r i te enab l e n otes : t h i s f i gure sho w s p i n ass i gnments , and does not sho w the ent i re socket adapter c i rcu i t . 1 . a reset osc ill at i on stab iliz at i on t i me (t osc1 ) of at l east 1 0 ms i s re q u i red . 2 . a 12 - m hz crysta l resonator shou l d be used . 3. as the fwe p i n becomes v cc i n the h 8s / 2 3 19 f-zt a t, the e m le p i n i s i gnored i n programmer mode . other p i ns figure 17.51 h8s/2319f-ztat socket adapter pin assignments
section 17 rom rev.7.00 feb. 14, 2007 page 672 of 1108 rej09b0089-0700 17.20.3 programmer mode operation table 17.35 shows how the different operating modes are set when using programmer mode, and table 17.36 lists the commands used in programmer mode. details of each mode are given below. memory read mode: memory read mode supports byte reads. auto-program mode: auto-program mode supports programming of 128 bytes at a time. status polling is used to confirm the end of auto-programming. auto-erase mode: auto-erase mode supports automatic erasing of the entire flash memory. status polling is used to confirm the end of auto-erasing. status read mode: status polling is used for auto-programming and auto-erasing, and normal termination can be confirmed by reading the i/o 6 signal. in status read mode, error information is output if an error occurs. table 17.35 settings for each opera ting mode in programmer mode pin names mode ce oe we i/o 7 to i/o 0 a 18 to a 0 read l l h data output ain output disable l h h hi-z command write l h l data input ain * 2 chip disable * 1 h hi-z legend: h: high level l: low level hi-z: high impedance : don?t care notes: 1. chip disable is not a standby state; internally, it is an operation state. 2. ain indicates that there is also address input in auto-program mode.
section 17 rom rev.7.00 feb. 14, 2007 page 673 of 1108 rej09b0089-0700 table 17.36 programmer mode commands 1st cycle 2nd cycle command name number of cycles mode address data mode address data memory read mode 1 + n write h'00 read ra dout auto-program mode 129 write h'40 write pa din auto-erase mode 2 write h'20 write h'20 status read mode 2 write h'71 write h'71 legend: ra: read address pa: program address : don?t care notes: 1. in auto-program mode, 129 cycles are required for command writing by a simultaneous 128-byte write. 2. in memory read mode, the number of cycles depends on the number of address write cycles (n). 17.20.4 memory read mode ? after the end of an auto-program, auto-erase, or status read operation, the command wait state is entered. to read memory contents, a transition must be made to memory read mode by means of a command write before the read is executed. ? command writes can be performed in memory read mode, just as in the command wait state. ? once memory read mode has been entered, consecutive reads can be performed. ? after power-on, memory read mode is entered.
section 17 rom rev.7.00 feb. 14, 2007 page 674 of 1108 rej09b0089-0700 table 17.37 ac characteristics in memory read mode conditions: v cc = 3.3 v 0.3 v, v ss = 0 v, t a = 25c 5c item symbol min max unit command write cycle t nxtc 20 ? s ce hold time t ceh 0 ? ns ce setup time t ces 0 ? ns data hold time t dh 50 ? ns data setup time t ds 50 ? ns write pulse width t wep 70 ? ns we rise time t r ? 30 ns we fall time t f ? 30 ns c e a 18 to a 0 d ata h' 00 o e w e command w rite t w ep t ceh t dh t ds t f t r t n x tc note: d ata is latched at the rising edge of w e . t ces memory read mode address stable d ata figure 17.52 memory read mode timing waveforms after command write
section 17 rom rev.7.00 feb. 14, 2007 page 675 of 1108 rej09b0089-0700 table 17.38 ac characteristics when entering another mode from memory read mode conditions: v cc = 3.3 v 0.3 v, v ss = 0 v, t a = 25c 5c item symbol min max unit command write cycle t nxtc 20 ? s ce hold time t ceh 0 ? ns ce setup time t ces 0 ? ns data hold time t dh 50 ? ns data setup time t ds 50 ? ns write pulse width t wep 70 ? ns we rise time t r ? 30 ns we fall time t f ? 30 ns c e a 18 to a 0 i/o 7 to i/o 0 o e w e other mode command w rite t ceh t ds t dh t f t r t n x tc note: d o not enable w e and o e at the same time. t ces t w ep memory read mode address stable figure 17.53 timing waveforms when entering another mode from memory read mode
section 17 rom rev.7.00 feb. 14, 2007 page 676 of 1108 rej09b0089-0700 table 17.39 ac characteristics in memory read mode conditions: v cc = 3.3 v 0.3 v, v ss = 0 v, t a = 25c 5c item symbol min max unit access time t acc ? 20 s ce output delay time t ce ? 150 ns oe output delay time t oe ? 150 ns output disable delay time t df ? 100 ns data output hold time t oh 5 ? ns c e a 18 to a 0 i/o 7 to i/o 0 o e w e vih vil vil t acc t oh t oh t acc address stable address stable figure 17.54 timing waveforms for ce / oe enable state read c e a 18 to a 0 i/o 7 to i/o 0 vih o e w e t ce t acc t oe t oh t oh t df t ce t acc t oe address stable address stable t df figure 17.55 timing waveforms for ce / oe clocked read
section 17 rom rev.7.00 feb. 14, 2007 page 677 of 1108 rej09b0089-0700 17.20.5 auto-program mode ? in auto-program mode, 128 bytes are programmed simultaneously. for this purpose, 128 consecutive byte data transfers should be performed. ? a 128-byte data transfer must be performed even if writing fewer than 128 bytes; in this case, h'ff data must be written to the extra addresses. ? the lower 7 bits of the transfer address must be held low. if an invalid address is input, memory programming will be started but a programming error will occur. ? memory address transfer is executed in the second cycle (figure 17.56). do not perform transfer later than the second cycle. ? do not perform a command write during a programming operation. ? perform one auto-programming operation for a 128-byte block for each address. one or more additional programming operations cannot be carried out on address blocks that have already been programmed. ? confirm normal end of auto-programming by checking i/o 6 . alternatively, status read mode can also be used for this purpose (the i/o 7 status polling pin is used to identify the end of an auto-program operation). ? status polling i/o 6 and i/o 7 information is retained until the next command write. as long as the next command write has not been performed, reading is possible by enabling ce and oe .
section 17 rom rev.7.00 feb. 14, 2007 page 678 of 1108 rej09b0089-0700 ac characteristics table 17.40 ac characteristics in auto-program mode conditions: v cc = 3.3 v 0.3 v, v ss = 0 v, t a = 25c 5c item symbol min max unit command write cycle t nxtc 20 ? s ce hold time t ceh 0 ? ns ce setup time t ces 0 ? ns data hold time t dh 50 ? ns data setup time t ds 50 ? ns write pulse width t wep 70 ? ns status polling start time t wsts 1 ? ms status polling access time t spa ? 150 ns address setup time t as 0 ? ns address hold time t ah 60 ? ns memory write time t write 1 3000 ms we rise time t r ? 30 ns we fall time t f ? 30 ns address stable c e a 18 to a 0 i/o 5 to i/o 0 i/o 6 i/o 7 o e w e t as t ah t dh t ds t f t r t w ep t w sts t w rite t spa t n x tc t n x tc t ceh t ces p rogramming operation end identification signal d ata transfer 1 byte to 128 bytes h'4 0 h' 00 p rogramming normal end identification signal figure 17.56 auto-program mode timing waveforms
section 17 rom rev.7.00 feb. 14, 2007 page 679 of 1108 rej09b0089-0700 17.20.6 auto-erase mode ? auto-erase mode supports only total memory erasing. ? do not perform a command write during auto-erasing. ? confirm normal end of auto-erasing by checking i/o 6 . alternatively, status read mode can also be used for this purpose (the i/o 7 status polling pin is used to identify the end of an auto-erase operation). ? status polling i/o 6 and i/o 7 pin information is retained until the next command write. as long as the next command write has not been performed, reading is possible by enabling ce and oe . ac characteristics table 17.41 ac characteristics in auto-erase mode conditions: v cc = 3.3 v 0.3 v, v ss = 0 v, t a = 25c 5c item symbol min max unit command write cycle t nxtc 20 ? s ce hold time t ceh 0 ? ns ce setup time t ces 0 ? ns data hold time t dh 50 ? ns data setup time t ds 50 ? ns write pulse width t wep 70 ? ns status polling start time t ests 1 ? ms status polling access time t spa ? 150 ns memory erase time t erase 100 40000 ms we rise time t r ? 30 ns we fall time t f ? 30 ns
section 17 rom rev.7.00 feb. 14, 2007 page 680 of 1108 rej09b0089-0700 c e a 18 to a 0 i/o 5 to i/o 0 i/o 6 i/o 7 o e w e t ests t erase t spa t dh t ds t f t r t w ep t n x tc t n x tc t ceh t ces erase end identifi- cation signal erase normal end confirmation signal h'2 0 h'2 0 h' 00 figure 17.57 auto-erase mode timing waveforms 17.20.7 status read mode ? status read mode is used to identify what ty pe of abnormal end has occurred. use this mode when an abnormal end occurs in auto-program mode or auto-erase mode. ? the return code is retained until a command write for other than status read mode is performed. table 17.42 ac characteristics in status read mode conditions: v cc = 3.3 v 0.3 v, v ss = 0 v, t a = 25c 5c item symbol min max unit command write cycle t nxtc 20 ? s ce hold time t ceh 0 ? ns ce setup time t ces 0 ? ns data hold time t dh 50 ? ns data setup time t ds 50 ? ns write pulse width t wep 70 ? ns oe output delay time t oe ? 150 ns disable delay time t df ? 100 ns ce output delay time t ce ? 150 ns we rise time t r ? 30 ns we fall time t f ? 30 ns
section 17 rom rev.7.00 feb. 14, 2007 page 681 of 1108 rej09b0089-0700 c e a 18 to a 0 i/o 7 to i/o 0 o e w e t dh t df t ds t f t r t w ep t n x tc t n x tc t f t r t w ep t ds t dh t n x tc t ceh t ceh t oe t ces t ces t ce h'71 h'71 note: i/o 3 and i/o 2 are undefined. figure 17.58 status read mode timing waveforms table 17.43 status read mode return commands pin name i/o 7 i/o 6 i/o 5 i/o 4 i/o 3 i/o 2 i/o 1 i/o 0 attribute normal end identification command error program- ming error erase error ? ? program- ming or erase count exceeded effective address error initial value 0 0 0 0 0 0 0 0 indications normal end: 0 abnormal end: 1 command error: 1 otherwise: 0 program- ming error: 1 otherwise: 0 erase error: 1 otherwise: 0 ? ? count exceeded: 1 otherwise: 0 effective address error: 1 otherwise: 0 note: i/o 3 and i/o 2 are undefined. 17.20.8 status polling ? the i/o 7 status polling flag indicates the operating status in auto-program or auto-erase mode. ? the i/o 6 status polling flag indicates a normal or ab normal end in auto-program or auto-erase mode.
section 17 rom rev.7.00 feb. 14, 2007 page 682 of 1108 rej09b0089-0700 table 17.44 status polling output truth table pin names internal operation in progress abnormal end ? normal end i/o 7 0 1 0 1 i/o 6 0 0 1 1 i/o 0 to i/o 5 0 0 0 0 17.20.9 programmer mode transition time commands cannot be accepted during the oscillation stabilization period or the programmer mode setup period. after the programmer mode setup time, a transition is made to memory read mode. table 17.45 command wait state transition time specifications item symbol min max unit standby release (oscillation stabilization time) t osc1 30 ? ms programmer mode setup time t bmv 10 ? ms v cc hold time t dwn 0 ? ms v cc r e s memory read mode command w ait state command w ait state normal/ abnormal end identification auto-program mode auto-erase mode t osc1 t bm v t d w n command acceptance figure 17.59 oscillation stabilization time, programmer mode setup time, and power supply fall sequence 17.20.10 notes on memory programming ? when programming addresses which have previously been programmed, carry out auto- erasing before auto-programming.
section 17 rom rev.7.00 feb. 14, 2007 page 683 of 1108 rej09b0089-0700 ? when performing programming using prom mode on a chip that has been programmed/erased in an on-board programming mode, auto-erasing is recommended before carrying out auto-programming. notes: 1. the flash memory is initially in the erased state when the device is shipped by renesas technology. for other chips for which the erasure history is unknown, it is recommended that auto-erasing be executed to check and supplement the initialization (erase) level. 2. auto-programming should be performed once only on the same address block. additional programming cannot be carried out on address blocks that have already been programmed.
section 17 rom rev.7.00 feb. 14, 2007 page 684 of 1108 rej09b0089-0700 17.21 flash memory programming and erasing precautions precautions concerning the use of on-board programming mode, the ram emulation function, and programmer mode are summarized below. use the specified voltages and timing for programming and erasing: applied voltages in excess of the rating can permanently damage the device. use a prom programmer that supports the renesas technology microcomputer device type with 512-kbyte on-chip flash memory (fztat512v3a). do not select the hn27c4096 setting for the prom programmer, and only use the specified socket adapter. failure to observe these points may result in damage to the device. powering on and off: when applying or disconnecting v cc power, fix the res pin low and place the flash memory in the hardware protection state. the power-on and power-off timing requirements should also be satisfied in the event of a power failure and subsequent recovery. use the recommended algorithm when pr ogramming and erasing flash memory: the recommended algorithm enables programming and er asing to be carried out without subjecting the device to voltage stress or sacrificing program data reliability. when setting the p1 or e1 bit in flmcr1 or the p2 or e2 bit in flmcr2, the watchdog timer should be set beforehand as a precaution against program runaway, etc. do not set or clear the swe1 and swe2 bit during execution of a program in flash memory: wait for at least 100 s after clearing the swe1 and swe2 bit before executing a program or reading data in flash memory. when the swe1 and swe2 bit is set, data in flash memory can be rewritten, but addresses h'000000 to h'03ffff in flash memory can only be read in program- verify or erase-verify mode when swe1 = 1, and addresses h' 040000 to h' 07ffff in flash memory can only be read in program-verify or erase-verify mode when swe2 = 1. access those address areas only for verify operations (verification during programming/erasing). also, do not clear the swe1 or swe2 bit during programming, erasing, or verifying. similarly, when using the ram emulation function the swe1 bit must be cleared before executing a program or reading data in flash memory. however, the ram area overlapping flash memory space can be read and written to regardless of whether the swe1 bit is set or cleared.
section 17 rom rev.7.00 feb. 14, 2007 page 685 of 1108 rej09b0089-0700 do not use interrupts while flash memory is being programmed or erased: when flash memory is programmed or erased, all interrupt requests, including nmi, should be disabled to give priority to program/erase operations. do not perform additional programming. erase the memory before reprogramming: in on- board programming, perform only one programming operation on a 128-byte programming unit block. in programmer mode, too, perform only one programming operation on a 128-byte programming unit block. programming should be carried out with the entire programming unit block erased. before programming, check that the chip is correctly mounted in the prom programmer: overcurrent damage to the device can result if the index marks on the prom programmer socket, socket adapter, and chip are not correctly aligned. do not touch the socket adapter or chip during programming: touching either of these can cause contact faults and write errors.
section 17 rom rev.7.00 feb. 14, 2007 page 686 of 1108 rej09b0089-0700 17.22 overview of flash memory (h8s/2319c 0.18m f-ztat) 17.22.1 features this lsi has an on-chip 512-kbyte flash memory. the flash memory has the following features. ? two flash-memory mats according to lsi initiation mode the on-chip flash memory has two memory spaces in the same address space (hereafter referred to as memory mats). the mode setting in the initiation determines which memory mat is initiated first. the mat can be switched by using the bank-switching method after initiation. ? the user memory mat is initiated at a power-on reset in user mode: 512 kbytes ? the user boot memory mat is initiated at a power-on reset in user boot mode: 8 kbytes ? on-board programming modes ? boot mode this mode is a program mode that uses an on-chip sci interface. the user mat and user boot mat can be programmed. this mode can automatically adjust the bit rate between host and this lsi. ? user program mode the user mat can be programmed by using the optional interface. ? user boot mode the user boot program of the optional interface can be made and the user mat can be programmed. ? prom mode this mode uses the prom programmer. the user mat and user boot mat can be programmed. ? programming/erasing interface by the download of on-chip program this lsi has a dedicated programming/erasing program. after downloading this program to the on-chip ram, programming/erasing can be performed by setting the argument parameter. ? emulation function of flash memory by using the on-chip ram as flash memory is overlapped with part of the on-chip ram, the flash memory programming can be emulated in real time. ? protection modes there are three protection modes: software protection by the register setting, hardware protection by reset/hardware standby, and e rror protection. the protection state for flash memory programming/erasing can be set.
section 17 rom rev.7.00 feb. 14, 2007 page 687 of 1108 rej09b0089-0700 when abnormalities, such as runaway of programming/erasing are detected, these modes enter the error protection state and the programming/erasing processing is suspended. ? programming/erasing time the flash memory programming time is 3 ms (typ) for 128-byte simultaneous programming, which is equivalent to 25 s per byte. the erasing time is 1000 ms (typ) per 64-kbyte block. ? number of programming flash memory programming can be performed a minimum of 100 times.
section 17 rom rev.7.00 feb. 14, 2007 page 688 of 1108 rej09b0089-0700 17.22.2 overview (1) block diagram fccs fpcs fecs fkey fmats ftdar ramer control unit memory mat unit flash memory user mat: 512 kbytes user boot mat: 8 kbytes operating mode module bus mode pin internal address bus internal data bus (16 bits) legend: fccs: flash code control and status register fpcs: flash program code select register fecs: flash erase code select register fkey: flash key code register fmats: flash mat select register ftdar: flash transfer destination address register ramer: ram emulation register note: to read from or write to any of the registers above except ramer, the flshe bit in system control register 2 (syscr2) must be set to 1. figure 17.60 block diagram of flash memory
section 17 rom rev.7.00 feb. 14, 2007 page 689 of 1108 rej09b0089-0700 17.22.3 operating mode of flash memory when each mode pin is set in the reset state and reset start is performed, the microcomputer enters each operating mode as shown in figure 17.61. for the setting of each mode pin, see table 17.52. ? flash memory cannot be read, programmed, or erased in rom invalid mode. ? flash memory can be read in user mode, but cannot be programmed or erased. ? flash memory can be read, programmed, or erased on the board only in user program mode, user boot mode, and boot mode. ? flash memory can be read, programmed, or erased by means of the prom programmer in prom mode. reset state rom i nva li d mode prom mode user mode user program mode user boot mode b oot mode on - board programm i ng mode fl s he=0 ram emu l at i on i s enab l ed fl s he= 1 res =0 rom i nva li d mode sett i ng res =0 user m od e se tt i ng res =0 use r boot mode sett i ng res =0 b oot m od e sett i ng res =0 res =0 prom mode sett i ng figure 17.61 mode transition of flash memory
section 17 rom rev.7.00 feb. 14, 2007 page 690 of 1108 rej09b0089-0700 17.22.4 mode comparison the comparison table of programming and erasing related items about boot mode, user program mode, user boot mode, and prom mode is shown in table 17.46. table 17.46 comparison of programming modes boot mode user program mode user boot mode prom mode programming/ erasing environment on-board programming on-board programming on-board programming on-board programming programming/ erasing enable mat user mat user boot mat user mat user mat user mat user boot mat program/erase control command method programming/ erasing interface programming/ erasing interface command method all erasure (automatic) (automatic) block division erasure * 1 program data transfer from host via sci from optional device via ram from optional device via ram via programmer ram emulation reset initiation mat embedded program storage mat user mat user boot mat * 2 ? transition to user mode mode setting change and reset flshe bit setting change mode setting change and reset ? notes: 1. all-erasure is performed. after that, the specified block can be erased. 2. initiation starts from the embedded program storage mat. after checking the flash- memory related registers, initiation starts from the reset vector of the user mat. ? the user boot mat can be programmed or erased only in boot mode and prom mode. ? the user mat and user boot mat are erased in boot mode. then, the user mat and user boot mat can be programmed by means of the command method. however, the contents of the mat cannot be read until this state. only user boot mat is programmed and the user mat is programmed in user boot mode or only user mat is programmed because user boot mode is not used. ? the boot operation of the optional interface can be performed by the mode pin setting different from user program mode in user boot mode.
section 17 rom rev.7.00 feb. 14, 2007 page 691 of 1108 rej09b0089-0700 17.22.5 flash mat configuration this lsi's flash memory is configured by the 512-kbyte user mat and 8-kbyte user boot mat. the start address is allocated to the same address in the user mat and user boot mat. therefore, when the program execution or data access is performed between two mats, the mat must be switched by using fmats. the user mat or user boot mat can be read in all modes if it is in rom valid mode. however, the user boot mat can be programmed only in boot mode and prom mode. a ddress h' 000000 a ddress h' 0 7ffff address h' 000000 address h' 00 1fff 512 kbytes 8 kbytes figure 17.62 flash memory configuration the user mat and user boot mat have different memory sizes. do not access a user boot mat that is 8 kbytes or more. when a user boot mat exceeding 8 kbytes is read from, an undefined value is read.
section 17 rom rev.7.00 feb. 14, 2007 page 692 of 1108 rej09b0089-0700 17.22.6 block division the user mat is divided into 64 kbytes (seven blocks), 32 kbytes (one block), and 4 kbytes (eight blocks) as shown in figure 17.63. the user mat can be erased in this divided-block units and the erase-block number of eb0 to eb15 is specified when erasing. the ram emulation can be performed in the eight blocks of 4 kbytes. address h' 000000 address h' 0 7ffff 512 kbytes 4 kbytes 8 32 kbytes 64 kbytes 64 kbytes 64 kbytes 64 kbytes 64 kbytes 64 kbytes 64 kbytes e b0 e b 7 to e b 8 e b 9 e b 1 0 e b 11 e b 12 e b 13 e b 14 e b 15 erase block note: * the ram emulation can be performed in the eight blocks of 4 kbytes. * figure 17.63 block division of user mat
section 17 rom rev.7.00 feb. 14, 2007 page 693 of 1108 rej09b0089-0700 17.22.7 programming/erasing interface programming/erasing is executed by downloading the on-chip program to the on-chip ram and specifying the program address/data and erase block by using the interface register/parameter. the procedure program is made by the user in user program mode and user boot mode. the overview of the procedure is as follows. for details, see section 17.24.2, user program mode. download on-chip program by setting fkey and the sco bits initialization execution (download program execution) select on-chip program to be downloaded and set download destination programming (in 128-byte units) or erasing (in one-block units) (download program execution) start user procedure program for programming/erasing end user procedure program programming/erasing completed? no yes figure 17.64 overview of user procedure program 1. selection of on-chip program to be downloaded and setting of download destination this lsi has programming/erasing programs and they can be downloaded to the on-chip ram. the on-chip program to be downloaded is selected by setting the corresponding bits in the programming/erasing interface register. the download destination can be specified by ftdar.
section 17 rom rev.7.00 feb. 14, 2007 page 694 of 1108 rej09b0089-0700 2. download of on-chip program the on-chip program is automatically downloaded by setting the sco bit in the flash key code register (fkey) and the flash code control and status register (fccs), which are programming/erasing interface registers. the user mat is replaced to the embedded prog ram storage area when downloading. since the flash memory cannot be read when programming/erasing, the procedure program, which is working from download to completion of programming/erasing, must be executed in a space other than the flash memory to be programmed/erased (for example, on-chip ram). since the result of download is returned to the programming/erasing interface parameters, whether the normal download is executed or not can be confirmed. 3. initialization of programming/erasing the operating frequency is set before execution of programming/erasing. this setting is performed by using the programming/erasing interface parameters. 4. programming/erasing execution to program or erase, the flshe bit in system control register 2 (syscr2) must be set to 1 and the user program mode must be entered. the program data/programming destination address is specified in 128-byte units when programming. the block to be erased is specified in erase-block units when erasing. these specifications are set by using the programming/erasing interface parameters and the on- chip program is initiated. the on-chip program is executed by using the jsr or bsr instruction to perform the subroutine call of the specified address in the on-chip ram. the execution result is returned to the programming/erasing interface parameters. the area to be programmed must be erased in advance when programming flash memory. all interrupts are prohibited during programming and erasing. interrupts must not occur in the user system. 5. when programming/erasing is executed consecutively when the processing is not ended by the 128-byte programming or one-block erasure, the program address/data and erase-block number must be updated and consecutive programming/erasing is required.
section 17 rom rev.7.00 feb. 14, 2007 page 695 of 1108 rej09b0089-0700 since the downloaded on-chip program is left in the on-chip ram after the processing, download and initialization are not required when the same processing is executed consecutively. 17.22.8 pin configuration flash memory is controlled by the pin as shown in table 17.47. table 17.47 pin configuration pin name abbreviation input/output function reset res input reset mode 2 md2 input sets operating mode of this lsi mode 1 md1 input sets operating mode of this lsi mode 0 md0 input sets operating mode of this lsi port 66 p66 input sets operating mode of this lsi in prom mode port 65 p65 input sets operating mode of this lsi in prom mode port 64 p64 input sets operating mode of this lsi in prom mode transmit data txd1 output serial transmit data output receive data rxd1 input serial receive data input note: for the pin configuration in prom mode, see section 17.28, prom mode. 17.22.9 register configuration (1) registers the registers/parameters which control flash memo ry when the on-chip flash memory is valid are shown in table 17.48. to access any of the flash memory control regi sters except ramer, the flshe bit in syscr2 must be set to 1 in a mode in which flash memory is enabled. there are several operating modes for accessing flash memory, for example, read mode/program mode.
section 17 rom rev.7.00 feb. 14, 2007 page 696 of 1108 rej09b0089-0700 there are two memory mats: user mat and user boot mat. the dedicated registers/parameters are allocated for each operating mode and mat se lection. the correspondence of operating modes and registers/parameters for use is shown in table 17.49. table 17.48 (1) register configuration name abbreviation r/w initial value address flash code control status register fccs r, w * 1 h'00 h'80 h'ffc4 flash program code select register fpcs r/w h'00 h'ffc5 flash erase code select register fecs r/w h'00 h'ffc6 flash key code register fkey r/w h'00 h'ffc8 flash mat select register fmats r/w h'00 * 2 h'aa * 2 h'ffc9 flash transfer destination address register ftdar r/w h'00 h'ffca system control register 2 syscr2 * 3 r/w h'00 h'ff42 ram emulation register ramer r/w h'00 h'fedb notes: 1. the bits except the sco bit are read-only bits. the sco bit is a programming-only bit. (the value which can be read is always 0.) 2. the initial value at initiation in user mode or user program mode is h'00. the initial value at initiation in user boot mode is h'aa. 3. syscr2 is dedicated to the f-ztat versions. table 17.48 (2) parameter configuration name abbreviation r/w initial value address download pass/fail result dpfr r/w undefined on-chip ram * flash pass/fail result fpfr r/w undefined r0l of cpu flash multipurpose address area fmpar r/w undefined er1 of cpu flash multipurpose data destination area fmpdr r/w undefined er0 of cpu flash erase block select febs r/w undefined er0 of cpu flash program and erase frequency control fpefeq r/w undefined er0 of cpu note: * one byte of the start address in the on-chip ram area specified by ftdar is valid.
section 17 rom rev.7.00 feb. 14, 2007 page 697 of 1108 rej09b0089-0700 table 17.49 register/parameter and target mode download initiali- zation program- ming erasure read ram emulation fccs ? ? ? ? ? fpcs ? ? ? ? ? pecs ? ? ? ? ? fkey ? ? ? programming/ erasing interface registers fmats ? ? * 1 * 1 * 2 ? fpfr ? ? fpefeq ? ? ? ? ? fmpar ? ? ? ? ? fmpdr ? ? ? ? ? programming/ erasing interface parameter febs ? ? ? ? ? ram emulation ramer ? ? ? ? ? notes: 1. the setting is required when programming or erasing user mat in user boot mode. 2. the setting may be required according to the combination of initiation mode and read target mat. 17.23 register description of flash memory 17.23.1 programming/erasing interface register the programming/erasing interface registers are as described below. they are all 8-bit registers that can be accessed in byte. except for the fler bit in fccs, these registers are initialized at a power-on reset, in hardware standby mode, or in software standby mode. the fler bit is not initialized in software standby mode.
section 17 rom rev.7.00 feb. 14, 2007 page 698 of 1108 rej09b0089-0700 (1) flash code control and status register (fccs) fccs is configured by bits which request the error occurrence during programming or erasing flash memory and the download of on-chip program. bit : 7 6 5 4 3 2 1 0 ? ? ? fler ? ? ? sco initial value : 1 0 0 0 0 0 0 0 r/w : r r r r r r r (r)/w bit 7?reserved: this bit is always read as 1. the write value should always be 1. bits 6 and 5?reserved: these bits are always read as 0. the write value should always be 0. bit 4?flash memory error (fler): indicates an error occurs during programming and erasing flash memory. when fler is set to 1, flash memory enters the error protection state. this bit is initialized at a power-on reset or in hardware standby mode. when fler is set to 1, high voltage is applied to the internal flash memory. to reduce the damage to flash memory, the reset must be released after the reset period of 100 s which is longer than normal. bit 4 fler description 0 flash memory operates normally (initial value) programming/erasing protection for flash memory (error protection) is invalid. [clearing condition] at a power-on reset or in hardware standby mode 1 indicates an error occurs during programming/erasing flash memory. programming/erasing protection for flash memory (error protection) is valid. [setting condition] see section 17.25.3, error protection. bits 3 to 1?reserved: these bits are always read as 0. the write value should always be 0.
section 17 rom rev.7.00 feb. 14, 2007 page 699 of 1108 rej09b0089-0700 bit 0?source program co py operation (sco): requests the on-chip programming/erasing program to be downloaded to the on-chip ram. when this bit is set to 1, the on-chip program which is selected by fpcs/fecs is automatically downloaded in the on-chip ram area specified by ftdar. in order to set this bit to 1, ram emulation state must be canceled, h'a5 must be written to fkey, and this operation must be in the on-chip ram. four nop instructions must be executed immediately after setting this bit to 1. since this bit is cleared to 0 when download is completed, this bit cannot be read as 1. all interrupts are prohibited during programming and erasing. interrupts must not occur in the user system. bit 0 sco description 0 download of the on-chip programming/erasing program to the on-chip ram is not executed (initial value) [clear condition] when download is completed 1 request that the on-chip programming/erasing program is downloaded to the on- chip ram is occurred [set conditions] when all of the following conditions are satisfied and 1 is written to this bit ? fkey is written to h'a5 ? during execution in the on-chip ram ? not in ram emulation mode (rams in ramer = 0)
section 17 rom rev.7.00 feb. 14, 2007 page 700 of 1108 rej09b0089-0700 (2) flash program code select register (fpcs) fpcs selects the on-chip programming program to be downloaded. bit : 7 6 5 4 3 2 1 0 ? ? ? ? ? ? ? ppvs initial value : 0 0 0 0 0 0 0 0 r/w : r r r r r r r r/w bits 7 to 1?reserved: these bits are always read as 0. the write value should always be 0. bit 0?program pulse verify (ppvs): selects the programming program. bit 0 ppvs description 0 on-chip programming program is not selected (initial value) [clear condition] when transfer is completed 1 on-chip programming program is selected (3) flash erase code select register (fecs) fecs selects download of the on-chip erasing program. bit : 7 6 5 4 3 2 1 0 ? ? ? ? ? ? ? epvb initial value : 0 0 0 0 0 0 0 0 r/w : r r r r r r r r/w bits 7 to 1?reserved: these bits are always read as 0. the write value should always be 0. bit 0?erase pulse verify block (epvb): selects the erasing program. bit 0 epvb description 0 on-chip erasing program is not selected (initial value) [clear condition] when transfer is completed 1 on-chip erasing program is selected
section 17 rom rev.7.00 feb. 14, 2007 page 701 of 1108 rej09b0089-0700 (4) flash key code register (fkey) fkey is a register for software protection that enables download of on-chip program and programming/erasing of flash memory. before setting the sco bit to 1 in order to download on- chip program or executing the downloaded programming/erasing program, these processing cannot be executed if the key code is not written. bit : 7 6 5 4 3 2 1 0 k7 k6 k5 k4 k3 k2 k1 k0 initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w bits 7 to 0?key code (k7 to k0): only when h'a5 is written, writing to the sco bit is valid. when the value other than h'a5 is written to fkey, 1 cannot be written to the sco bit. therefore downloading to the on-chip ram cannot be executed. only when h'5a is written, programming/erasing can be executed. even if the on-chip programming/erasing program is executed, flash memory cannot be programmed or erased when the value other than h'5a is written to fkey. bits 7 to 0 k7 to k0 description h'a5 writing to the sco bit is enabled (the sco bit cannot be set by the value other than h'a5.) h'5a programming/erasing is enabled (the value other than h'5a is in software protection state.) h'00 initial value
section 17 rom rev.7.00 feb. 14, 2007 page 702 of 1108 rej09b0089-0700 (5) flash mat select register (fmats) fmats specifies whether user mat or user boot mat is selected. bit : 7 6 5 4 3 2 1 0 ms7 ms6 ms5 ms4 ms3 ms2 ms1 ms0 initial value : 0 0 0 0 0 0 0 0 (when not in user boot mode) initial value : 1 0 1 0 1 0 1 0 (when in user boot mode) r/w : r/w r/w r/w r/w r/w r/w r/w r/w bits 7 to 0?mat select (ms7 to ms0): these bits are in user-mat selection state when the value other than h'aa is written and in user-boot-mat selection state when h'aa is written. the mat is switched by writing the value in fmats. when the mat is switched, follow section 17.27, switching between user mat and user boot mat. (the user boot mat cannot be programmed in user programming mode if user boot mat is selected by fmats. the user boot mat must be programmed in boot mode or in prom mode.) bits 7 to 0 ms7 to ms0 description h'aa the user boot mat is selected (in user-mat selection state when the value of these bits are other than h'aa) initial value when these bits are initiated in user boot mode. h'00 initial value when these bits are initiated in a mode except for user boot mode (in user-mat selection state) [programmable condition] these bits are in the execution state in the on-chip ram.
section 17 rom rev.7.00 feb. 14, 2007 page 703 of 1108 rej09b0089-0700 (6) flash transfer destination address register (ftdar) ftdar specifies the on-chip ram address to which the on-chip program is downloaded. make settings for ftdar before writing 1 to the sco bit in fccs. the initial value is h'00 which points to the start address (h'ffbc00) in on-chip ram. bit : 7 6 5 4 3 2 1 0 tder tda6 tda5 tda4 tda3 tda2 tda1 tda0 initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w r/w r/w r/w r/w r/w bit 7?transfer destination address setting error: this bit is set to 1 when there is an error in the download start address set by bits 6 to 0 (tda6 to tda0). whether the address setting is erroneous or not is judged by checking whether the setting of tda6 to tda0 is between the range of h'00 and h'03 after setting the sco bit in fccs to 1 and performing download. before setting the sco bit to 1 be sure to set the ftdar value between h'00 to h'03 as well as clearing this bit to 0. bit 7 tder description (return value after download) 0 setting of tda6 to tda0 is normal (initial value) 1 setting of tder and tda4 to tda0 is h'04 to h'ff and download has been aborted bits 6 to 0?transfer destination address (tda6 to tda0): these bits specify the download start address. a value from h'00 to h'03 can be set to specify the download start address in on- chip ram in 4-kbyte units. a value from h'04 to h'7f cannot be set. if such a value is set, the tder bit (bit 7) in this register is set to 1 to prevent download from being executed.
section 17 rom rev.7.00 feb. 14, 2007 page 704 of 1108 rej09b0089-0700 bits 6 to 0 tda6 to tda0 description h'00 download start address is set to h'ffbc00 h'01 download start address is set to h'ffcc00 h'02 download start address is set to h'ffdc00 h'03 download start address is set to h'ffec00 h'04 to h'7f setting prohibited. if this value is set, the tder bit (bit 7) is set to 1 to abort the download processing. 17.23.2 programming/erasing interface parameter the programming/erasing interface parameter specifies the operating frequency, storage place for program data, programming destination address, and erase block and exchanges the processing result for the downloaded on-chip program. this parameter uses the general registers of the cpu (er0 and er1) or the on-chip ram area. the initial value is undefined at a power-on reset or in hardware standby mode. when download, initialization, or on-chip program is executed, registers of the cpu except for er0 and er1 are stored. the return value of the processing result is written in r0l. since the stack area is used for storing the registers except for er0 and er1, the stack area must be saved at the processing start. (a maximum size of a stack area to be used is 128 bytes.) the programming/erasing interface parameter is used in the following four items. (1) download control (2) initialization before programming or erasing (3) programming (4) erasing these items use different parameters. the correspondence table is shown in table 17.50. here the fpfr parameter returns the results of initialization processing, programming processing, or erasing processing, but the meaning of the bits differs depending on the type of processing. for details, refer to the fpfr descriptions for the individual processes.
section 17 rom rev.7.00 feb. 14, 2007 page 705 of 1108 rej09b0089-0700 table 17.50 usable parameters and target modes name of parameter abbre- viation down- load initializa- tion program- ming erasure r/w initial value alloca- tion download pass/ fail result dpfr ? ? ? r/w undefined on-chip ram * flash pass/fail result fpfr ? r/w undefined r0l of cpu flash programming/ erasing frequency control fpefeq ? ? ? r/w undefined er0 of cpu flash multipurpose address area fmpar ? ? ? r/w undefined er1 of cpu flash multi- purpose data destination area fmpdr ? ? ? r/w undefined er0 of cpu flash erase block select febs ? ? ? r/w undefined er0 of cpu note: * one byte of start address of download destination specified by ftdar (1) download control the on-chip program is automatically downloaded by setting the sco bit to 1. the on-chip ram area to be downloaded is the area as much as 4 kbytes starting from the start address specified by ftdar. for the address map of the on-chip ram, see figure 17.69. the download control is set by using the programming/erasing interface register. the return value is given by the dpfr parameter. (a) download pass/fail result parameter (dpfr: one byte of start address of on-chip ram specified by ftdar) this parameter indicates the return value of the download result. the value of this parameter can be used to determine if downloading is executed or not. since the confirmation whether the sco bit is set to 1 is difficult, the certain determination must be performed by setting one byte of the start address of the on-chip ram area specified by ftdar to a value other than the return value of download (for example, h'ff) before the download start (before setting the sco bit to 1). refer to item [e] in the user program mode programming procedure portion of section 17.24.2, for information on the method for checking the download result.
section 17 rom rev.7.00 feb. 14, 2007 page 706 of 1108 rej09b0089-0700 bit : 7 6 5 4 3 2 1 0 0 0 0 0 0 ss fk sf initial value : ? ? ? ? ? ? ? ? r/w : ? ? ? ? ? r/w r/w r/w bits 7 to 3?reserved: return 0. bit 2?source select error detect (ss): the on-chip program which can be downloaded can be specified only one type. when more than two types of the program are selected, the program is not selected, or the program is selected without mapping, error is occurred. bit 2 ss description 0 download program can be selected normally 1 download error is occurred (multi-selecti on or program which is not mapped is selected) bit 1?flash key register error detect (fk): returns the check result whether the value of fkey is set to h'a5. bit 1 fk description 0 fkey setting is normal (fkey = h'a5) 1 setting value of fkey becomes error (fkey = value other than h'a5) bit 0?success/fail (sf): returns the result whether download is ended normally or not. the judgement result whether program that is downloaded to the on-chip ram is read back and then transferred to the on-chip ram is returned. bit 0 sf description 0 downloading on-chip program is ended normally (no error) 1 downloading on-chip program is ended abnormally (error occurs)
section 17 rom rev.7.00 feb. 14, 2007 page 707 of 1108 rej09b0089-0700 (2) programming/erasing initialization the on-chip programming/erasing program to be downloaded includes the initialization program. the specified period pulse must be applied when programming or erasing. the specified pulse width is made by the method in which wait loop is configured by the cpu instruction. the operating frequency of the cpu must be set. the initial program is set as a parameter of the programming/erasing program which has downloaded these settings. (a) flash programming/erasing frequency pa rameter (fpefeq: general register er0 of cpu) this parameter sets the operating frequency of the cpu. the operating frequency range of this lsi is 2 mhz to 25 mhz. bit : 31 30 29 28 27 26 25 24 0 0 0 0 0 0 0 0 initial value : ? ? ? ? ? ? ? ? r/w : ? ? ? ? ? ? ? ? bit : 23 22 21 20 19 18 17 16 0 0 0 0 0 0 0 0 initial value : ? ? ? ? ? ? ? ? r/w : ? ? ? ? ? ? ? ? bit : 15 14 13 12 11 10 9 8 f15 f14 f13 f12 f11 f10 f9 f8 initial value : ? ? ? ? ? ? ? ? r/w : r/w r/w r/w r/w r/w r/w r/w r/w bit : 7 6 5 4 3 2 1 0 f7 f6 f5 f4 f3 f2 f1 f0 initial value : ? ? ? ? ? ? ? ? r/w : r/w r/w r/w r/w r/w r/w r/w r/w bits 31 to 16?reserved: only 0 may be written to these bits.
section 17 rom rev.7.00 feb. 14, 2007 page 708 of 1108 rej09b0089-0700 bits 15 to 0?frequency set (f15 to f0): set the operating frequency of the cpu. the setting value must be calculated as the following methods. 1. the operating frequency which is shown in mhz units must be rounded in a number to three decimal places and be shown in a number of two decimal places. 2. the centuplicated value is converted to the binary digit and is written to the fpefeq parameter (general register er0). for example, when the operating frequency of the cpu is 25.000 mhz, the value is as follows. ? the number to three decimal places of 25.000 is rounded and the value is thus 25.00. ? the formula that 25.00 100 = 2500 is converted to the binary digit and b'0000,1001,1100,0100 (h'09c4) is set to er0. (b) flash pass/fail parameter (fpfr : general register r0l of cpu) this is the return value indicating the initialization result. bit : 7 6 5 4 3 2 1 0 0 0 0 0 0 0 fq sf initial value : ? ? ? ? ? ? ? ? r/w : ? ? ? ? ? ? r/w r/w bits 7 to 2?reserved: return 0. bit 1?frequency error detect (fq): returns the check result whether the specified operating frequency of the cpu is in the range of the supported operating frequency. bit 1 fq description 0 setting of operating frequency is normal 1 setting of operating frequency is abnormal bit 0?success/fail (sf): indicates whether initialization is completed normally. bit 0 sf description 0 initialization is ended normally (no error) 1 initialization is ended abnormally (error occurs)
section 17 rom rev.7.00 feb. 14, 2007 page 709 of 1108 rej09b0089-0700 (3) programming execution when flash memory is programmed, the programming destination address on the user mat must be passed to the programming program in which the program data is downloaded. 1. the start address of the programming destination on the user mat is set in general register er1 of the cpu. this parameter is called fmpar (flash multipurpose address area parameter). since the program data is always in 128-byte units, the lower eight bits (a7 to a0) must be h'00 or h'80 as the boundary of the programming start address on the user mat. 2. the program data for the user mat must be prepared in the consecutive area. the program data must be in the consecutive space which can be accessed by using the mov.b instruction of the cpu and is not the flash memory space. when data to be programmed does not satisfy 128 bytes, the 128-byte program data must be prepared by embedding the dummy code (h'ff). the start address of the area in which the prepar ed program data is stored must be set in general register er0. this parameter is called fmpdr (flash multipurpose data destination area parameter). for details on the programming procedure, see section 17.24.2, user program mode.
section 17 rom rev.7.00 feb. 14, 2007 page 710 of 1108 rej09b0089-0700 (a) flash multipurpose address area parame ter (fmpar: general register er1 of cpu) this parameter indicates the start address of the programming destination on the user mat. when an address in an area other than the flash memory space is set, an error occurs. the start address of the programming destination must be at the 128-byte boundary. if this boundary condition is not satisfied, an error occurs. the error occurrence is indicated by the wa bit (bit 1) in fpfr. fmpar bit : 31 30 29 28 27 26 25 24 moa31 moa30 moa29 moa 28 moa27 moa26 moa25 moa24 initial value : ? ? ? ? ? ? ? ? r/w : r/w r/w r/w r/w r/w r/w r/w r/w bit : 23 22 21 20 19 18 17 16 moa23 moa22 moa21 moa 20 moa19 moa18 moa17 moa16 initial value : ? ? ? ? ? ? ? ? r/w : r/w r/w r/w r/w r/w r/w r/w r/w bit : 15 14 13 12 11 10 9 8 moa15 moa14 moa13 moa12 moa11 moa10 moa9 moa8 initial value : ? ? ? ? ? ? ? ? r/w : r/w r/w r/w r/w r/w r/w r/w r/w bit : 7 6 5 4 3 2 1 0 moa7 moa6 moa5 moa4 moa3 moa2 moa1 moa0 initial value : ? ? ? ? ? ? ? ? r/w : r/w r/w r/w r/w r/w r/w r/w r/w bits 31 to 0?moa31 to moa0: store the start address of the programming destination on the user mat. the consecutive 128-byte programming is executed starting from the specified start address of the user mat. therefore, the specified programming start address becomes a 128-byte boundary and moa6 to moa0 are always 0.
section 17 rom rev.7.00 feb. 14, 2007 page 711 of 1108 rej09b0089-0700 (b) flash multipurpose data destination parameter (fmpdr: general register er0 of cpu): this parameter indicates the start address in the area which stores the data to be programmed in the user mat. when the storage destination of the program data is in flash memory, an error occurs. the error occurrence is indicat ed by the wd bit (bit 2) in fpfr. fmpdr bit : 31 30 29 28 27 26 25 24 mod31 mod30 mod29 mod28 mod27 mod26 mod25 mod24 initial value : ? ? ? ? ? ? ? ? r/w : r/w r/w r/w r/w r/w r/w r/w r/w bit : 23 22 21 20 19 18 17 16 mod23 mod22 mod21 mod20 mod19 mod18 mod17 mod16 initial value : ? ? ? ? ? ? ? ? r/w : r/w r/w r/w r/w r/w r/w r/w r/w bit : 15 14 13 12 11 10 9 8 mod15 mod14 mod13 mod12 mod11 mod10 mod9 mod8 initial value : ? ? ? ? ? ? ? ? r/w : r/w r/w r/w r/w r/w r/w r/w r/w bit : 7 6 5 4 3 2 1 0 mod7 mod6 mod5 mod4 mod3 mod2 mod1 mod0 initial value : ? ? ? ? ? ? ? ? r/w : r/w r/w r/w r/w r/w r/w r/w r/w bits 31 to 0?mod31 to mod0: store the start address of the area which stores the program data for the user mat. the consecutive 128-byte data is programmed to the user mat starting from the specified start address.
section 17 rom rev.7.00 feb. 14, 2007 page 712 of 1108 rej09b0089-0700 (c) flash pass/fail parameter (fpfr : general register r0l of cpu) an explanation of fpfr as the return value indicating the programming result is provided here. bit : 7 6 5 4 3 2 1 0 0 md ee fk 0 wd wa sf initial value : ? ? ? ? ? ? ? ? r/w : ? r/w r/w r/w ? r/w r/w r/w bit 7?reserved: returns 0. bit 6?programming mode related setting error detect (md): returns the check result of whether the error protection state has been entered. if the error protection state has been entered, 1 is wr itten to this bit. this state can be confirmed by checking bit 4, fler, in the fccs register. for conditions to enter the error protection state, see section 17.25.3, error protection. bit 6 md description 0 fler setting is normal (fler = 0) 1 fler = 1, and programming cannot be performed bit 5?programming execution error detect (ee): 1 is returned to this bit when the specified data could not be written because the user mat was not erased. if this bit is set to 1, there is a high possibility that the user mat is partially rewritten. in this case, after removing the error factor, erase the user mat. if fmats is set to h'aa and the user boot mat is selected, an error occurs when programming is performed. in this case, both the user mat and user boot mat are not rewritten. programming of the user boot mat should be performed in the boot mode or prom mode. bit 5 ee description 0 programming has ended normally 1 programming has ended abnormally (pr ogramming result is not guaranteed)
section 17 rom rev.7.00 feb. 14, 2007 page 713 of 1108 rej09b0089-0700 bit 4?flash key register error detect (fk): returns the check result of the value of fkey before the start of the programming processing. bit 4 fk description 0 fkey setting is normal (fkey = h'5a) 1 fkey setting is error (fkey = value other than h'5a) bit 3?reserved: returns 0. bit 2?write data address detect (wd): when flash memory area is specified as the start address of the storage destination of the program data, an error occurs. bit 2 wd description 0 setting of write data address is normal 1 setting of write data address is abnormal bit 1?write address error detect (wa): when the following area is specified as the start address of the programming destination, an error occurs. 1. if the start address is outside the flash memory area 2. if the specified address is not a 128-byte boundary (a6 to a0 are not 0) bit 1 wa description 0 setting of programming destination address is normal 1 setting of programming destination address is abnormal bit 0?success/fail (sf): indicates whether the program processing is ended normally or not. bit 0 sf description 0 programming is ended normally (no error) 1 programming is ended abnormally (error occurs)
section 17 rom rev.7.00 feb. 14, 2007 page 714 of 1108 rej09b0089-0700 (4) erasure execution when flash memory is erased, the erase-block number on the user mat must be passed to the erasing program which is downloaded. this is set to the febs parameter (general register er0). one block is specified from the block number 0 to 15. for details on the erasing processing procedur e, see section 17.24.2, user program mode. (a) flash erase block select parameter (febs: general register er0 of cpu) this parameter specifies the erase-block number. the several block numbers cannot be specified. bit : 31 30 29 28 27 26 25 24 0 0 0 0 0 0 0 0 initial value : ? ? ? ? ? ? ? ? r/w : r/w r/w r/w r/w r/w r/w r/w r/w bit : 23 22 21 20 19 18 17 16 0 0 0 0 0 0 0 0 initial value : ? ? ? ? ? ? ? ? r/w : r/w r/w r/w r/w r/w r/w r/w r/w bit : 15 14 13 12 11 10 9 8 0 0 0 0 0 0 0 0 initial value : ? ? ? ? ? ? ? ? r/w : r/w r/w r/w r/w r/w r/w r/w r/w bit : 7 6 5 4 3 2 1 0 eb7 eb6 eb5 eb4 eb3 eb2 eb1 eb0 initial value : ? ? ? ? ? ? ? ? r/w : r/w r/w r/w r/w r/w r/w r/w r/w bits 31 to 8?reserved: only 0 may be written to these bits. bits 7 to 0?erase block (eb7 to eb0): set the erase-block number in the range from 0 to 15. 0 corresponds to the eb0 block and 15 corresponds to the eb15 block. an error occurs when the number other than 0 to 15 is set.
section 17 rom rev.7.00 feb. 14, 2007 page 715 of 1108 rej09b0089-0700 (b) flash pass/fail parameter (fpfr : general register r0l of cpu) an explanation of fpfr as the return value indicating the erase result is provided here. bit : 7 6 5 4 3 2 1 0 0 md ee fk eb 0 0 sf initial value : ? ? ? ? ? ? ? ? r/w : ? r/w r/w r/w r/w ? ? r/w bit 7?reserved: returns 0. bit 6?erasure mode related setting error detect (md): returns the check result of whether the error protection state has been entered. if the error protection state has been entered, 1 is wr itten to this bit. this state can be confirmed by checking bit 4, fler, in the fccs register. for conditions to enter the error protection state, see section 17.25.3, error protection. bit 6 md description 0 fler settings is normal (fler = 0) 1 fler = 1, and erasure cannot be performed bit 5?erasure execution error detect (ee): 1 is returned to this bit when the user mat could not be erased. if this bit is set to 1, there is a high possibility that the user mat is partially erased. in this case, after removing the error factor, erase the user mat. if fmats is set to h'aa and the user boot mat is selected, an error occurs when erasure is performed. in this case, both the user mat and user boot mat are not erased. erasing of the user boot mat should be performed in the boot mode or prom mode. bit 5 ee description 0 erasure has ended normally 1 erasure has ended abnormally (erasure result is not guaranteed)
section 17 rom rev.7.00 feb. 14, 2007 page 716 of 1108 rej09b0089-0700 bit 4?flash key register error detect (fk): returns the check result of fkey value before start of the erasing processing. bit 4 fk description 0 fkey setting is normal (fkey = h'5a) 1 fkey setting is error (fkey = value other than h'5a) bit 3?erase block select error detect (eb): returns the check result whether the specified erase-block number is in the block range of the user mat. bit 3 eb description 0 setting of erase-block number is normal 1 setting of erase-block number is abnormal bits 2 and 1?reserved: return 0. bit 0?success/fail (sf): indicates whether the erasing processing is ended normally or not. bit 0 sf description 0 erasure is ended normally (no error) 1 erasure is ended abnormally (error occurs)
section 17 rom rev.7.00 feb. 14, 2007 page 717 of 1108 rej09b0089-0700 17.23.3 system control register 2 (syscr2) bit : 7 6 5 4 3 2 1 0 ? ? ? ? flshe ? ? ? initial value : 0 0 0 0 0 0 0 0 r/w : ? ? ? ? r/w ? ? r/w syscr2 is an 8-bit readable/writable register that performs on-chip flash memory control. syscr2 is initialized to h'00 by a reset and in hardware standby mode. syscr2 can only be used in the f-ztat versions. in the mask rom versions this register will return an undefined value if read, and cannot be modified. bits 7 to 4?reserved: these bits cannot be modified and are always read as 0. bit 3?flash memory control register enable (flshe): controls cpu access to the flash memory control registers (fccs, fpcs, fecs, fkey, fmats, ftdar). writing 1 to the flshe bit enables the flash memory control regist ers to be read and written to. clearing flshe to 0 designates these registers as unselected (the register contents are retained). bit 3 flshe description 0 flash control registers are not selected for addresses h'ffffc4 to h'ffffcf (initial value) 1 flash control registers are selected for addresses h'ffffc4 to h'ffffcf bits 2 and 1?reserved: these bits cannot be modified and are always read as 0. bit 0?reserved: only 0 may be written to this bit.
section 17 rom rev.7.00 feb. 14, 2007 page 718 of 1108 rej09b0089-0700 17.23.4 ram emulation register (ramer) bit : 7 6 5 4 3 2 1 0 ? ? ? ? rams ram2 ram1 ram0 initial value : 0 0 0 0 0 0 0 0 r/w : ? ? ? ? r/w r/w r/w r/w ramer specifies the area of flash memory to be overlapped with part of ram when emulating real-time flash memory programming. ramer is initialized to h'00 by a reset and in hardware standby mode. it is not initialized in software standby mode. ramer settings should be made in user mode or user program mode. flash memory area divisions are shown in table 17.51. to ensure correct operation of the emulation function, the rom for which ram emulation is performed should not be accessed immediately after this register has been modified. normal execution of an access immediately after register modification is not guaranteed. bits 7 to 4?reserved: these bits cannot be modified and are always read as 0. bit 3?ram select (rams): specifies selection or non-selection of flash memory emulation in ram. when rams = 1, all flash memory blocks are program/erase-protected. bit 3 rams description 0 emulation not selected (initial value) program/erase-protection of all flash memory blocks is disabled 1 emulation selected program/erase-protection of all flash memory blocks is enabled
section 17 rom rev.7.00 feb. 14, 2007 page 719 of 1108 rej09b0089-0700 bits 2 to 0?flash memory area selection (ram2 to ram0): these bits are used together with bit 3 to select the flash memory area to be overlapped with ram (see table 17.51). table 17.51 flash memory area divisions ram area block name rams ram2 ram1 ram0 h'ffdc00 to h'ffebff ram area, 4 kbytes 0 h'000000 to h'000fff eb0 (4 kbytes) 1 0 0 0 h'001000 to h'001fff eb1 (4 kbytes) 1 0 0 1 h'002000 to h'002fff eb2 (4 kbytes) 1 0 1 0 h'003000 to h'003fff eb3 (4 kbytes) 1 0 1 1 h'004000 to h'004fff eb4 (4 kbytes) 1 1 0 0 h'005000 to h'005fff eb5 (4 kbytes) 1 1 0 1 h'006000 to h'006fff eb6 (4 kbytes) 1 1 1 0 h'007000 to h'007fff eb7 (4 kbytes) 1 1 1 1 : don?t care
section 17 rom rev.7.00 feb. 14, 2007 page 720 of 1108 rej09b0089-0700 17.24 on-board programming mode when the pin is set in on-board programming mode and the reset start is executed, the on-board programming state that can program/erase the on-chip flash memory is entered. on-board programming mode has three operating modes: user programming mode, user boot mode, and boot mode. table 17.52 lists the pin setting for entering each mode. for details on the state transition of each mode for flash memory, see figure 17.61. table 17.52 setting on-board programming modes mode pins mcu mode cpu operating modes/description md2 md1 md0 user boot mode advanced single-chip mode 0 0 1 boot mode advanced expanded mode with on-chip rom enabled 0 1 0 advanced single-chip mode 1 user program mode * advanced expanded mode with on-chip rom enabled 1 1 0 advanced single-chip mode 1 note: * normally, user mode should be used. before downloading a program/erase program, set the flshe bit to 1 to switch to the user program mode. 17.24.1 boot mode boot mode executes programming/erasing user mat and user boot mat by means of the control command and program data transmitted from the host using the on-chip sci. the tool for transmitting the control command and program data must be prepared in the host. the sci communication mode is set to asynchronous mode. when reset start is executed after this lsi's pin is set in boot mode, the boot program in the microcomputer is initiated. after the sci bit rate is automatically adjusted, the communication with the host is executed by means of the control command method. the system configuration diagram in boot mode is shown in figure 17.65. for details on the pin setting in boot mode, see table 17.52. the nmi and other interrupts are ignored in boot mode. make sure the nmi and other interrupts do not occur in the user system.
section 17 rom rev.7.00 feb. 14, 2007 page 721 of 1108 rej09b0089-0700 host rxd1 txd1 control command, analysis execution software (on-chip) flash memory on-chip ram on-chip sci1 this lsi b oot programming tool and program data control command, program data reply response figure 17.65 system configuration in boot mode sci interface setting by host: when boot mode is initiated, this lsi measures the low period of asynchronous sci-communication data (h'00), which is transmitted consecutively by the host. the sci transmit/receive format is set to 8-bit data , 1 stop bit, and no parity. this lsi calculates the bit rate of transmission by the host by means of the measured low period and transmits the bit adjustment end sign (1 byte of h'00) to the host. the host must confirm that this bit adjustment end sign (h'00) has been received normally and transmits 1 byte of h'55 to this lsi. when reception is not executed normally, boot mode is initiated again (reset) and the operation described above must be executed. the bit rate between the host and this lsi is not matched by the bit rate of transmission by the host and system clock frequency of this lsi. to operate the sci normally, the transfer bit rate of the host must be set to 9,600 bps or 19,200 bps. the system clock frequency which can automatically adjust the transfer bit rate of the host and the bit rate of this lsi is shown in table 17.53. boot mode must be initiated in the range of this system clock. d 0 d1 d2 d3 d4 d5 d6 d7 start bit stop bit measure low period (9 bits) (data is h' 00 ) high period of at least 1 bit figure 17.66 automatic adjustment operation of sci bit rate
section 17 rom rev.7.00 feb. 14, 2007 page 722 of 1108 rej09b0089-0700 table 17.53 system clock frequency that can automatically adjust bit rate of this lsi bit rate of host system clock frequency which can automatically adjust bit rate of this lsi 19,200 bps 16 mhz to 25 mhz 9,600 bps 8 mhz to 25 mhz state transition: the overview of the state transition after boot mode is initiated is shown in figure 17.67. for details on boot mode, refer to section 17.29.1, serial communications interface specification for boot mode. [1] bit rate adjustment after boot mode is initiated, the bit rate of the sci interface is adjusted with that of the host. [2] waiting for inquiry set command for inquiries about user-mat size and configuration, mat start address, and support state, the required information is transmitted to the host. [3] automatic erasure of all user mat and user boot mat after inquiries have finished, all user mat and user boot mat are automatically erased. [4] waiting for programming/erasing command ? when the program preparation notice is received, the state for waiting program data is entered. the programming start address and program data must be transmitted following the programming command. when programming is finished, the programming start address must be set to h'ffffffff and transmitted. then the state for waiting program data is returned to the state of programming/erasing command wait. ? when the erasure preparation notice is received, the state for waiting erase-block data is entered. the erase-block number must be transmitted following the erasing command. when the erasure is finished, the erase-block number must be set to h'ff and transmitted. then the state for waiting erase-block data is returned to the state for waiting programming/erasing command. the erasure must be executed when reset start is not executed and the specified block is programmed after programming is executed in boot mode. when programming can be executed by only one operation, all blocks are erased before the state for waiting programming/erasing/other command is entered. the erasing operation is not required. ? there are many commands other than programming/erasing. examples are sum check, blank check (erasure check), and memory read of the user mat/user boot mat and acquisition of current status information.
section 17 rom rev.7.00 feb. 14, 2007 page 723 of 1108 rej09b0089-0700 note that memory read of the user mat/user boot mat can only read the program data after all user mat/user boot mat has automatically been erased. wait for inquiry setting command wait for programming/erasing command b it rate adjustment processing of read/check command b oot mode initiation (reset by boot mode) h' 00 to h' 00 reception h' 00 transmission (adjustment completed) ( b it rate adjustment) processing of inquiry setting command all user mat and user boot mat erasure wait for program data wait for erase-block data read/check command reception command response (program command reception) (program data transmission) (erasure command reception) (program end) (erase-block specification) (erasure end) inquiry command reception h'55 reception inquiry command response [1] [2] [3] [4] figure 17.67 overview of boot mode state transition
section 17 rom rev.7.00 feb. 14, 2007 page 724 of 1108 rej09b0089-0700 17.24.2 user program mode the user mat can be programmed/erased in user program mode. (the user boot mat cannot be programmed/erased.) programming/erasing is executed by downloading the program in the microcomputer. the programming/erasing overview flow is shown in figure 17.68. high voltage is applied to internal flash memory during the programming/erasing processing. therefore, transition to reset or hardware standby must not be executed. doing so may cause damage or destroy flash memory. if reset is executed accidentally, reset must be released after the reset input period, which is longer than normal 100 s. for information on the programming procedure re fer to "programming procedure in user program mode", and for information on the erasing proced ure refer to "erasing procedure in user program mode", below. for the overview of a processing that repeat s erasing and programming by downloading the programming program and the erasing program in separate on-chip rom areas using ftdar, see "erasing and programming procedure in user program mode" which appears later in this section. when programming, program data is prepared programming/erasing procedure program is transferred to the on-chip ram and executed programming/erasing start programming/erasing end [1] ram emulation mode must be canceled in advance. download cannot be executed in emulation mode. [2] when the program data is made by means of emulation, use the ftdar register to change the download destination. note that the download area and the emulation area will overlap if ftdar is in its initial status (h' 0 2). [3] programming/erasing is executed only in the on-chip ram. however, if program data is in a consecutive area and can be accessed by the mov. b instruction of the cpu like sram/rom, the program data can be in an external space. [4] after programming/erasing is finished, the fwe pin must be protected. figure 17.68 programming/erasing overview flow
section 17 rom rev.7.00 feb. 14, 2007 page 725 of 1108 rej09b0089-0700 on-chip ram address map when programming/erasing is executed: parts of the procedure program that are made by the user, like download request, programming/erasing procedure, and judgement of the result, must be executed in the on-chip ram. the on-chip program that is to be downloaded is all in the on-chip ram. note that area in the on-chip ram must be controlled so that these parts do not overlap. figure 17.69 shows the program area to be downloaded. ram emulation area or area that can be used by user dpfr (return value: 1 byte) ftdar setting ftdar setting+16 ftdar setting+32 ftdar setting+4k h'ffdc 00 < on-chip ram > address ramtop(h'ff b c 00 ) system use area (15 bytes) programming/erasing entry initialization process entry initialization + programming program or initialization + erasing program area that can be used by user area that can be used by user area that can be used by user h'ffec 00 ramend(h'fff b ff) a rea to be downloaded (size: 4 kbytes) unusable area in programming/erasing processing period figure 17.69 ram map when programming/erasing is executed
section 17 rom rev.7.00 feb. 14, 2007 page 726 of 1108 rej09b0089-0700 programming procedure in user program mode: the procedures for download, initialization, and programming are shown in figure 17.70. select on-chip program to be downloaded and set download destination by ftdar set fkey to h'a5 set sco to 1 and execute download dfpr= 0 ? yes no download error processing set the fpefeq and fu b ra parameters initialization jsr ftdar setting+32 yes end programming procedure program fpfr= 0 ? no initialization error processing disable interrupts and bus master operation other than cpu clear fkey to 0 set parameter to er 0 and er1 (fmpar and fmpdr) programming jsr ftdar setting+16 yes fpfr= 0 ? no clear fkey and programming error processing yes required data programming is completed? no set fkey to h'5a clear fkey to 0 (a) (b) (d) (e) (f) (g) (h) (i) (j) (k) (l) (m) (n) (o) 1 1 (c) download initialization programming start programming procedure program figure 17.70 programming procedure the procedure program must be executed in an area other than the flash memory to be programmed. especially the part where the sco bit in fccs is set to 1 for downloading must be executed in the on-chip ram. the area that can be executed in the steps of the user procedure program (on-chip ram, user mat, and external space) is shown in section 17.29.3, procedure program and storable area for programming data. the following description assumes the area to be programmed on the user mat is erased and program data is prepared in the consecutive ar ea. when erasing is not executed, erasing is executed before writing. 128-byte programming is performed in one program processing. when more than 128-byte programming is performed, programming destina tion address/program data parameter is updated in 128-byte units and programming is repeated.
section 17 rom rev.7.00 feb. 14, 2007 page 727 of 1108 rej09b0089-0700 when less than 128-byte programming is performed, data must total 128 bytes by adding the invalid data. if the invalid data to be added is h'ff, the program processing period can be shorted. [1] select the on-chip program to be downloaded and the download destination. when the ppvs bit of fpcs is set to 1, the programming program is selected. several programming/erasing programs cannot be selected at one time. if several programs are set, download is not performed and a download error is returned to the source select error detect (ss) bit in the dpfr parameter. specify the start address of the download destination by ftdar. [2] program h'a5 in fkey if h'a5 is not written to fkey for protection, 1 cannot be written to the sco bit for download request. [3] 1 is written to the sco bit of fccs and then download is executed. to write 1 to the sco bit, the following conditions must be satisfied. ? ram emulation mode is canceled. ? h'a5 is written to fkey. ? the sco bit writing is executed in the on-chip ram. when the sco bit is set to 1, download is started automatically. when the sco bit is returned to the user procedure program, the sco is cl eared to 0. therefore, the sco bit cannot be confirmed to be 1 in the user procedure program. the download result can be confirmed only by the return value of the dpfr parameter. before the sco bit is set to 1, incorrect judgement must be prevented by setting the dpfr parameter, that is one byte of the start address of the on-chip ram area specified by ftdar, to a value other than the return value (h'ff). when download is executed, particular interru pt processing, which is accompanied by the bank switch as described below, is performed as an internal microcomputer processing. four nop instructions are executed immediately after the instructions that set the sco bit to 1. (a) the user-mat space is switched to the on-chip program storage area. (b) after the selection condition of the download program and the address set in ftdar are checked, the transfer processing is executed starting from the on-chip ram address specified by ftdar. (c) the sco bits in fpcs, fecs , and fccs are cleared to 0. (d) the return value is set to the dpfr parameter. (e) after the on-chip program storage area is retu rned to the user-mat space, the user procedure program is returned. ? in the download processing, the values are stored in the general registers other than er0 and er1of the cpu.
section 17 rom rev.7.00 feb. 14, 2007 page 728 of 1108 rej09b0089-0700 ? no interrupts are accepted during download proce ssing. however, interrupt requests are held, so when processing returns to the user procedure program and interrupts are generated. when the level-detection interrupt requests are to be held, interrupts must be put until the download is ended. ? when hardware standby mode is entered during download processing, the normal download cannot be guaranteed in the on-chip ram. therefore, download must be executed again. ? since a stack area of a maximum 128 bytes is used, the area must be saved before setting the sco bit to 1. ? if flash memory is accessed by the dtc or breq during downloading, the operation cannot be guaranteed. therefore, access by the dtc or breq must not be executed. [4] fkey is cleared to h'00 for protection. [5] the value of the dpfr parameter must be checked and the download result must be confirmed. a recommended procedure for confirming the download result is shown below. ? check the value of the dpfr parameter (one byte of start address of the download destination specified by ftdar). if the value is h'00, download has been performed normally. if the value is not h'00, the source that caused download to fail can be investigated by the description below. ? if the value of the dpfr parameter is the same as before downloading (e.g. h'ff), the address setting of the download destination in ftdar may be abnormal. in this case, confirm the setting of the tder bit (bit 7) in ftdar. ? if the value of the dpfr parameter is different from before downloading, check the ss bit (bit 2) and the fk bit (bit 1) in the dpfr parameter to ensure that the download program selection and fkey register setting were normal, respectively. [6] the operating frequency is set to the fpefeq parameter for initialization. ? the current frequency of the cpu clock is set to the fpefeq parameter (general register: er0). the settable range of the fpefeq parameter is 2 mhz to 25 mhz. when the frequency is set out of this range, an error is returned to the fpfr parameter of the initialization program and initialization is not performed. for details on the frequency setting, see the description in 17.23.2 (2) (a) flash programming/erasing frequency parameter (fpefeq: general register er0 of cpu).
section 17 rom rev.7.00 feb. 14, 2007 page 729 of 1108 rej09b0089-0700 [7] initialization when a programming program is downloaded, the initialization program is also downloaded to the on-chip ram. there is an entry point of the initialization program in the area from (download start address set by ftdar) + 32 bytes. the subroutine is called and initialization is executed by using the following steps. mov.l #dltop+32,er2 ; set entry address to er2 jsr @er2 ; call initialization routine nop ? the general registers other than er0 and er1 are saved in the initialization program. ? r0l is a return value of the fpfr parameter. ? since the stack area is used in the initialization program, a stack area of a maximum 128 bytes must be saved in ram. ? interrupts can be accepted during the execution of the initialization program. the program storage area and stack area in the on-chip ram and register values must not be destroyed. [8] the return value in the initialization program, fpfr (general register r0l) is judged. [9] all interrupts and the use of a bus master other than the cpu are prohibited. the specified voltage is applied for the specified time when programming or erasing. if interrupts occur or the bus mastership is moved to other than the cpu during this time, more than the specified voltage will be applied and flash memory may be damaged. therefore, interrupts and movement of bus mastership to dtc or breq other than the cpu are prohibited. the interrupt processing prohibition is set up by setting the bit 7 (i) in the condition code register (ccr) of the cpu to b'1. then interrupts other than nmi are held and are not executed. the nmi interrupts must not occur in the user system. the interrupts that are held must be processed in executed after all program processing. when the bus mastership is moved to dtc or breq or dram refresh except for the cpu, the error protection state is entered. therefore, reservation of bus mastership by dtc or breq is prohibited. [10] fkey must be set to h'5a and the user mat must be prepared for programming.
section 17 rom rev.7.00 feb. 14, 2007 page 730 of 1108 rej09b0089-0700 [11] the parameter which is required for programming is set. the start address of the programming destination of the user mat (fmpar) is set to general register er1. the start address of the program data storage area (fmpdr) is set to general register er0. ? example of the fmpar setting fmpar specifies the programming destination address. when an address other than one in the user mat area is specified, even if the programming program is executed, programming is not executed and an error is returned to the return value parameter fpfr. since the unit is 128 bytes, the lower eight bits (a7 to a0) must be in the 128-byte boundary of h'00 or h'80. ? example of the fmpdr setting when the storage destination of the program data is flash memory, even if the program execution routine is executed, programming is no t executed and an error is returned to the fpfr parameter. in this case, the program data must be transferred to the on-chip ram and then programming must be executed. [12] programming there is an entry point of the programming program in the area from (download start address set by ftdar) + 16 bytes of on-chip ram. the subroutine is called and programming is executed by using the following steps. mov.l #dltop+16,er2 ; set entry address to er2 jsr @er2 ; call programming routine nop ? the general registers other than er0 and er1 are saved in the programming program. ? r0 is a return value of the fpfr parameter. ? since the stack area is used in the programming program, a stack area of a maximum 128 bytes must be reserved in ram [13] the return value in the programming program, fpfr (general register r0l) is judged. [14] determine whether programming of the necessary data has finished. if more than 128 bytes of data are to be programmed, specify fmpar and fmpdr in 128- byte units, and repeat steps (l) to (n). increment the programming destination address by 128 bytes and update the programming data pointer correctly. if an address which has already been programmed is written to again, not only will a programming error occur, but also flash memory will be damaged.
section 17 rom rev.7.00 feb. 14, 2007 page 731 of 1108 rej09b0089-0700 [15] after programming finishes, clear fkey and specify software protection. if this lsi is restarted by a power-on reset immediately after user mat programming has finished, secure a reset period (period of res = 0) that is at least as long as normal 100 s. erasing procedure in user program mode: the procedures for download, initialization, and erasing are shown in figure 17.71. start erasing procedure program select on-chip program to be downloaded and set download destination by ftdar set fkey to h'a5 set sco to 1 and execute download dpfr = 0 ? yes no download error processing set the fpefeq and fu b ra parameters initialization jsr ftdar setting +32 yes end erasing procedure program fpfr= 0 ? no initialization error processing disable interrupts and bus master operation other than cpu clear fkey to 0 set fe b s parameter erasing jsr ftdar setting +16 yes fpfr= 0 ? no clear fkey and erasing error processing yes required block erasing is completed? no set fkey to h'5a clear fkey to 0 (a) (b) (c) (d) (e) (f) 1 1 download initialization erasing figure 17.71 erasing procedure the procedure program must be executed in an area other than the user mat to be erased. especially the part where the sco bit in fccs is set to 1 for downloading must be executed in on- chip ram. the area that can be executed in the steps of the user procedure program (on-chip ram, user mat, and external space) is shown in section 17.29.3, procedure program and storable area for programming data. for the downloaded on-chip program area, refer to the ram map for programming/erasing in figure 17.69.
section 17 rom rev.7.00 feb. 14, 2007 page 732 of 1108 rej09b0089-0700 a single divided block is erased by one erasing processing. for block divisions, refer to figure 17.63, block division of user mat. to erase two or more blocks, update the erase block number and perform the erasing processing for each block. [1] select the on-chip program to be downloaded set the epvb bit in fecs to 1. several programming/erasing programs cannot be selected at one time. if several programs are set, download is not performed and a download error is returned to the source select error detect (ss) bit in the dpfr parameter. the procedures to be carried out after setting fkey, e.g. download and initialization, are the same as those in the programming procedure. for de tails, refer to programming procedure in user program mode in section 17. 24.2, user program mode. [2] set the febs parameter necessary for erasure set the erase block number of the user mat in the flash erase block select parameter febs (general register er0). if a value other than an erase block number of the user mat is set, no block is erased even though the erasing program is executed, and an error is returned to the return value parameter fpfr. [3] erasure similar to as in programming, there is an entry point of the erasing program in the area from (download start address set by ftdar) + 16 bytes of on-chip ram. the subroutine is called and erasing is executed by using the following steps. mov.l #dltop+16,er2 ; set entry address to er2 jsr @er2 ; call erasing routine nop ? the general registers other than er0 and er1 are saved in the erasing program. ? r0 is a return value of the fpfr parameter. ? since the stack area is used in the erasing program, a stack area of a maximum 128 bytes must be reserved in ram [4] the return value in the erasing program, fpfr (general register r0l) is judged. [5] determine whether erasure of the necessary blocks has finished. if more than one block is to be erased, update the febs parameter and repeat steps (b) to (e). blocks that have already been erased can be erased again.
section 17 rom rev.7.00 feb. 14, 2007 page 733 of 1108 rej09b0089-0700 [6] after erasure finishes, clear fkey and specify software protection. if this lsi is restarted by a power-on reset immediately after user mat erasure has finished, secure a reset period (period of res = 0) that is at least as long as normal 100 s. erasing and programming procedure in user program mode: by changing the on-chip ram address of the download destination in ftdar, the erasing program and programming program can be downloaded to separate on-chip ram areas. figure 17.72 shows an example of repetitively executing ram emulation, erasing, and programming. start procedure program erasing program download programming program download emulation/erasing/programming set ftdar to h' 00 (specify h'ff b c 00 as download destination) set ftdar to h' 0 1 (specify h'ffcc 00 as download destination) download erasing program initialize erasing program initialize programming program download programming program 1 end procedure program enter ram emulation mode and tune data in on-chip ram set fmpdr to h'ffdc 00 to program relevant block (execute programming program) cancel ram emulation mode confirm operation 1 erase relevant block (execute erasing program) end ? yes no figure 17.72 sample procedure of repeating ram emulation, erasing, and programming (overview) in the above example, the erasing program and programming program are downloaded to areas excluding the 4 kbytes (h'ffdc00 to h'ffec00) from h'ffdc00.
section 17 rom rev.7.00 feb. 14, 2007 page 734 of 1108 rej09b0089-0700 download and initialization are performed only once at the beginning. in this kind of operation, note the following: ? be careful not to damage on-chip ram with overlapped settings. in addition to the ram emulation area, erasing program area, and programming program area, areas for the user procedure programs, work area, and stack area are reserved in on-chip ram. do not make settings that will overwrite data in these areas. ? be sure to initialize both the erasing program and programming program. initialization by setting the fpefeq parameter must be performed for both the erasing program and the programming program. initialization must be executed for both entry addresses: (download start address for erasing program) + 32 bytes (h'ffbc20 in this example) and (download start address for programming program) + 32 bytes (h'ffcc20 in this example). 17.24.3 user boot mode this lsi has user boot mode which is initiated with different mode pin settings than those in user program mode or boot mode. user boot mode is a user-arbitrary boot mode, unlike boot mode that uses the on-chip sci. only the user mat can be programmed/erased in user boot mode. programming/erasing of the user boot mat is only enabled in boot mode or programmer mode. user boot mode initiation: for the mode pin settings to start up user boot mode, see table 17.52. when the reset start is executed in user boot mode, the built-in check routine runs. the user mat and user boot mat states are checked by this check routine. while the check routine is running, nmi and all other interrupts cannot be accepted. next, processing starts from the execution start address of the reset vector in the user boot mat. at this point, h'aa is set to the flash mat select register fmats because the execution mat is the user boot mat. user mat programming in user boot mode: for programming the user mat in user boot mode, additional processings made by setting fmats are required: switching from user-boot- mat selection state to user-mat selection state, and switching back to user-boot-mat selection state after programming completes. figure 17.73 shows the procedure for programming the user mat in user boot mode.
section 17 rom rev.7.00 feb. 14, 2007 page 735 of 1108 rej09b0089-0700 se l ect on - ch i p program to be down l oaded and set down l oad dest i nat i on by ft dar set fkey to h' a5 dp f r =0 ? y es n o down l oad error process i ng set the f p efe q and parameter i n i t i a li zat i on jsr ft dar sett i ng + 32 y es e nd programm i ng procedure program f p f r =0 ? n o i n i t i a li zat i on error process i ng d i sab l e i nterrupts and bus master operat i on other than cpu c l ear fkey to 0 set parameter to e r 0 and e r1 ( f mpar and f mpdr) programm i ng jsr ft dar sett i ng + 16 y es f p f r =0 ? n o y es requ i red data programm i ng i s comp l eted? n o set fkey to h' 5a c l ear fkey to 0 1 1 down l oad i n i t i a li zat i on programm i ng ma t sw i tchover ma t sw i tchover set f ma t s to va l ue other than h' aa to se l ect user ma t set sco to 1 and execute down l oad c l ear fkey and programm i ng error process i ng * set f ma t s to h' aa to se l ect user boot ma t user - boot - ma t se l ect i on state user - ma t se l ect i on state user - boot - ma t se l ect i on state n ote : * t he ma t must be sw i tched by f ma t s to perform the programm i ng error process i ng i n the user boot ma t. start programm i ng procedure program figure 17.73 procedure for programming user mat in user boot mode the difference between the programming procedures in user program mode and user boot mode is whether the mat is switched or not as shown in figure 17.73. in user boot mode, the user boot mat can be seen in the flash memory space with the user mat hidden in the background. the user mat and user boot mat are switched only while the user mat is being programmed. because the user boot mat is hidden while the user mat is being programmed, the procedure program must be located in an area other than flash memory. after programming finishes, switch the mats again to return to the first state. mat switchover is enabled by writing a specific value to fmats. however note that while the mats are being switched, the lsi is in an unstable state, e.g. access to a mat is not allowed until mat switching is completely finished, and if an interrupt occurs, from which mat the interrupt
section 17 rom rev.7.00 feb. 14, 2007 page 736 of 1108 rej09b0089-0700 vector is read from is undetermined. perfor m mat switching in accordance with the description in section 17.27, switching between user mat and user boot mat. except for mat switching, the programming procedure is the same as that in user program mode. the area that can be executed in the steps of the user procedure program (on-chip ram, user mat, and external space) is shown in section 17.29.3, procedure program and storable area for programming data. user mat erasing in user boot mode: for erasing the user mat in user boot mode, additional processings made by setting fmats are required: switching from user-boot-mat selection state to user-mat selection state, and switching back to user-boot-mat selection state after erasing completes. figure 17.74 shows the procedure for erasing the user mat in user boot mode. start erasing procedure program select on-chip program to be downloaded set fkey to h'a5 and set download destination by ftdar dpfr= 0 ? yes no download error processing set the fpefeq parameter initialization jsr ftdar setting+32 yes end erasing procedure program fpfr= 0 ? no initialization error processing disable interrupts and bus master operation other than cpu clear fkey to 0 set fe b s parameter programming jsr ftdar setting+16 yes fpfr= 0 ? no clear fkey and erasing error processing * yes required block erasing is completed? no set fkey to h'5a clear fkey to 0 1 1 download initialization erasing set fmats to value other than h'aa to select user mat set sco to 1 and execute download set fmats to h'aa to select user boot mat user-boot-mat selection state user-mat selection state user-boot-mat selection state note: * the mat must be switched by fmats to perform the erasing error processing in the user boot mat. mat switchover mat switchover figure 17.74 procedure for eras ing user mat in user boot mode
section 17 rom rev.7.00 feb. 14, 2007 page 737 of 1108 rej09b0089-0700 the difference between the erasing procedures in user program mode and user boot mode depends on whether the mat is switched or not as shown in figure 17.74. mat switching is enabled by writing a specific value to fmats. however note that while the mats are being switched, the lsi is in an unstable state, e.g. access to a mat is not allowed until mat switching is completed finished, and if an interrupt occurs, from which mat the interrupt vector is read from is undetermined. perfor m mat switching in accordance with the description in section 17.27, switching between user mat and user boot mat. except for mat switching, the erasing procedure is the same as that in user program mode. the area that can be executed in the steps of the user procedure program (on-chip ram, user mat, and external space) is shown in section 17.29.3, procedure program and storable area for programming data.
section 17 rom rev.7.00 feb. 14, 2007 page 738 of 1108 rej09b0089-0700 17.25 protection there are three kinds of flash memory program/erase protection: hardware, software protection, and error protection. 17.25.1 hardware protection programming and erasing of flash memory is forcibly disabled or suspended by hardware protection. in this state, the downloading of an on-chip program and initialization of the flash memory are possible. however, an activated program for programming or erasure cannot program or erase locations in a user mat, and the e rror in programming/erasing is reported in the parameter fpfr. table 17.54 hardware protection function to be protected item description download program/erase reset/standby protection ? a power-on reset (including a power- on reset by the wdt) and entry to standby mode reinitialize the program/erase interface register and the device enters a program/erase- protected state. ? resetting by means of the res pin after power is initially supplied will not make the device enter the reset state unless the res pin is held low until oscillation has stabilized. in the case of a reset during operation, hold the res pin low for the res pulse width that is specified in the section on ac characteristics section. if the device is reset during programming or erasure, data values in the flash memory are not guaranteed. in this case, after keeping the res pin low for at least 100 s, execute erasure and then execute programming again. yes yes
section 17 rom rev.7.00 feb. 14, 2007 page 739 of 1108 rej09b0089-0700 17.25.2 software protection software protection is set up in any of three ways: by disabling the downloading of on-chip programs for programming and erasing, by means of a key code, and by the ram-emulation register. table 17.55 software protection function to be protected item description download program/erase protection by the sco bit ? clearing the sco bit in the fccs register makes the device enter a program/erase-protected state, and this disables the downloading of the programming/erasing programs. protection by the fkey register ? downloading and programming/erasing are disabled unless the required key code is written in the fkey register. different key codes are used for downloading and for programming/erasing. emulation protection ? setting the rams bit in the ram emulation register (ramer) makes the device enter a program/erase- protected state. 17.25.3 error protection error protection is a mechanism for aborting programming or erasure when an error occurs, in the form of the microcomputer entering runaway during programming/erasing of the flash memory or operations that are not according to the established procedures for programming/erasing. aborting programming or erasure in such cases prevents damage to the flash memory due to excessive programming or erasing. if the microcomputer malfunctions during programming/erasing of the flash memory, the fler bit in the fccs register is set to 1 and the device enters the error-protection state, and this aborts the programming or erasure. the fler bit is set in the following conditions:
section 17 rom rev.7.00 feb. 14, 2007 page 740 of 1108 rej09b0089-0700 (1) when an interrupt, such as nmi, has occurred during programming/erasing (2) when the relevant block area of flash memory is read during programming/erasing (including a vector read or an instruction fetch) (3) when a sleep instruction (including software standby mode) is executed during programming/erasing (4) when a bus master other than the cpu, such as dtc or breq , has obtained the bus right during programming/erasing error protection is cancelled only by a power-on reset or by hardware-standby mode. note that the reset should only be released after providing a reset input over a period longer than the normal 100 s period. since high voltages are applied during programming/erasing of the flash memory, some voltage may remain after the error-protection state has been entered. for this reason, it is necessary to reduce the risk of damage to the flash memory by extending the reset period so that the charge is released. the state-transition diagram in figure 17.75 shows transitions to and from the error-protection state. reset or standby (hardware protection) program mode erase mode error protection mode error-protection mode (software standby) read disabled programming/erasing enabled fler= 0 read disabled programming/erasing disabled fler= 0 read enabled programming/erasing disabled fler=1 read disabled programming/erasing disabled fler=1 r e s = 0 or h s tby = 0 error occurrence error occurrence (software standby) r e s = 0 or h s tby = 0 software-standby mode cancel software-standby mode r e s = 0 or h s tby = 0 program/erase interface register is in its initial state. program/erase interface register is in its initial state. figure 17.75 transitions to a nd from the error-protection state
section 17 rom rev.7.00 feb. 14, 2007 page 741 of 1108 rej09b0089-0700 17.26 flash memory emulation in ram to provide real-time emulation in ram of data that is to be written to the flash memory, a part of the ram can be overlaid on an area of flash memory (user mat) that has been specified by the ram emulation register (ramer). after the ramer setting is made, the ram is accessible in both the user mat area and as the ram area that has been overlaid on the user mat area. such emulation is possible in both user mode and user-program mode. figure 17.76 shows an example of the emulation of realtime programming of the user mat area. start of emulation program set ramer write the data for tuning to the overlaid ram area execute application program tuning ok? cancel ramer setting program the user mat with the emulated block end of emulation program yes no figure 17.76 emulation of flash memory in ram
section 17 rom rev.7.00 feb. 14, 2007 page 742 of 1108 rej09b0089-0700 e b0 h' 00000 e b 1 h' 0 1 000 e b 2 h' 0 2 000 e b 3 h' 0 3 000 e b 4 h' 0 4 000 e b 5 h' 0 5 000 e b 6 h' 0 6 000 e b 7 h' 0 7 000 h' 0 8 000 h'7ffff flash memory (user mat) e b 8 to e b 15 h'ffdc 00 h'ff b c 00 h'ffe b ff h'fff b ff on-chip ram this area is accessible as both a ram area and as a flash memory area. figure 17.77 example of a ram-overlap operation figure 17.77 shows an example of an overlap on block area eb0 of the flash memory. emulation is possible for a single area selected from among the eight areas, from eb0 to eb7, of user mat bank 0. the area is selected by the se tting of the ram2 to ram0 bits in the ramer register. (1) to overlap a part of the ram on area eb0, to allow realtime programming of the data for this area, set the ramer register's rams bit to 1, and each of the ram2 to ram0 bits to 0. (2) realtime programming is carried out using the overlaid area of ram. in programming or erasing the user mat, it is necessary to run a program that implements a series of procedural steps, including the downloading of a on-chip program. in this process, set the download area with ftdar so that the over laid ram area and the area where the on-chip program is to be downloaded do not overlap. an ftdar setting of h'02 will cause part of the tuned data area to overlap with part of the download area. when using the initial setting of ftdar, the data that is to be programmed must be saved beforehand in an area that is not used by the system.
section 17 rom rev.7.00 feb. 14, 2007 page 743 of 1108 rej09b0089-0700 figure 17.78 shows an example of programming of the data, after emulation has been completed, to the eb0 area in the user mat. e b0 h' 00000 e b 1 h' 0 1 000 e b 2 h' 0 2 000 e b 3 h' 0 3 000 e b 4 h' 0 4 000 e b 5 h' 0 5 000 e b 6 h' 0 6 000 e b 7 h' 0 7 000 h' 0 8 000 h'7ffff flash memory (user mat) e b 8 to e b 15 h'ff b c 00 h'ffcc 00 h'ffdc 00 h'ffe b ff h'fff b ff on-chip ram download area area for the programming-procedure program copy of the tuned data [1] cancel the emulation mode. [2] transfer the user-created program/ erase-procedure program. [3] download the on-chip programming/erasing programs, avoiding the tuning data area set in ftdar. [4] execute programming after erasing, as necessary. figure 17.78 programming of the data after tuning [1] after the data to be programmed has fixed values, clear the rams bit to 0 to cancel the overlap of ram. [2] transfer the user programming/erasing procedure program to ram. [3] run the programming/erasing procedure program in ram and download the on-chip programming/erasing program. specify the download start address with ftdar so that the tuned data area does not overlap with the download area. [4] when the eb0 area of the user mat has not been erased, the programming program will be downloaded after erasure. set the parameters fmpar and fmpdr so that the tuned data is designated, and execute programming. note: setting the rams bit to 1 puts all the blocks in the flash mat into a program/erase- protected state regardless of the values of the ram2 to ram0 bits (emulation protection). in this state, downloading of the on-chip prog rams is also disabled, so clear the rams bit before actual programming or erasure.
section 17 rom rev.7.00 feb. 14, 2007 page 744 of 1108 rej09b0089-0700 17.27 switching between user mat and user boot mat it is possible to alternate between the user mat and user boot mat. however, the following procedure is required because these mats are allocated to address 0. (switching to the user boot mat disables programming and erasing. programming of the user boot mat should take place in boot mode or prom mode.) (1) mat switching by the fmats register should always be executed from the on-chip ram. (2) to ensure that the mat that has been switched to is accessible, execute 4 nop instructions in the on-chip ram immediately before or after writing to the fmats register of the on-chip ram (this prevents access to the flash memory during mat switching). (3) if an interrupt has occurred during switching, there is no guarantee of which memory mat is being accessed. always mask the maskable interrupts before switching between mats. in addition, configure the system so that nmi interrupts do not occur during mat switching. (4) after the mats have been switched, take care because the interrupt vector table will also have been switched. methods for processing the same interrupt before and after mat switching include the following: ? prepare the same interrupt processing routines and interrupt vectors in both the user mat and user boot mat. ? transfer the interrupt processing routines to on-chip ram beforehand and set the interrupt vectors to the same on-chip ram addresses for both the user mat and user boot mat. (5) memory sizes of the user mat and user boot mat are different. when accessing the user boot mat, do not access addresses above the top of its 8-kbyte memory space. if access goes beyond the 8-kbyte space, the values read are undefined.
section 17 rom rev.7.00 feb. 14, 2007 page 745 of 1108 rej09b0089-0700 < user mat >< on-chip ram >< user boot mat > procedure for switching to the user boot mat procedure for switching to the user mat procedure for switching to the user boot mat [1] mask interrupts [2] write h'aa to the fmats register. [3] execute 4 nop instructions before accessing the user boot mat. procedure for switching to the user mat [1] mask interrupts [2] write a value other than h'aa to the fmats register. [3] execute 4 nop instructions before or after accessing the user mat. figure 17.79 switching between the user mat and user boot mat 17.27.1 usage notes 1. download time of on-chip program the programming program that includes the initialization routine and the erasing program that includes the initialization routine are each 2 kbytes or less. accordingly, when the cpu clock frequency is 25 mhz, the download for each program takes approximately 164 s at maximum. 2. write to flash-memory related registers by dtc while an instruction in on-chip ram is being executed, the dtc can write to the sco bit in fccs that is used for a download request or fmats that is used for mat switching. make sure that these registers are not accidentally written to, otherwise an on-chip program may be downloaded and damage ram or a mat switchover may occur and the cpu get out of control. do not use dtc to program flash related registers. 3. compatibility with programming/erasing program of conventional f-ztat h8s microcomputer a programming/erasing program for flash memory used in the conventional f-ztat h8s microcomputer which does not support download of the on-chip program by a sco transfer request cannot run in this lsi. be sure to download the on-chip program to execute programming/erasing of flash memory in this lsi.
section 17 rom rev.7.00 feb. 14, 2007 page 746 of 1108 rej09b0089-0700 4. monitoring runaway by wdt unlike the conventional f-ztat h8s microcomputer, no countermeasures are available for a runaway by wdt during programming/erasing by the downloaded on-chip program. prepare countermeasures (e.g. use of the user branch routine and periodic timer interrupts) for wdt while taking the programming/erasing time into consideration as required. 17.28 prom mode along with its on-board programming mode, this lsi also has a prom mode as a further mode for the writing and erasing of programs and data. in the prom mode, a general-purpose prom programmer can freely be used to write programs to the on-chip rom. program/erase is possible on the user mat and user boot mat. the prom programmer must support renesas technology microcomputers with 512-kbyte flash memory units as a device type. a status-polling system is adopted for operation in automatic program, automatic erase, and status-read modes. in the status-read mode, details of the system's internal signals are output after execution of automatic programming or automatic erasure. in the prom mode, provide a 12-mhz input-clock signal. table 17.56 prom mode pins pin names settings/external circuit connection mode pins: md2, md1, md0 low level input to md2, md1, and md0 mode setting pins: pf2, pf1, pf0 high level input to pf2, low level input to pf1 and pf0 stby pin high-level input (do not select hardware standby mode) res pin reset circuit xtal, extal pins oscillator circuit other pins requiring setting: p23, p25 high-level input to p23, low-level input to p25
section 17 rom rev.7.00 feb. 14, 2007 page 747 of 1108 rej09b0089-0700 17.28.1 pin arrangement of the socket adapter attach the socket adapter to the lsi in the way shown in figure 17.81. this allows conversion to 40 pins. figure 17.80 shows the memory mapping of the on-chip rom, and figure 17.81 shows the arrangement of the socket adapter's pins. h' 000000 h' 0 7ffff a ddress in mcu mode address in mcu mode address in prom mode address in prom mode h' 00000 h'7ffff h' 000000 h' 00 1fff h' 00000 h' 0 1fff on-chip rom space (user boot mat) 8 kbytes on-chip rom space (user mat) 512 kbytes figure 17.80 mapping of on-chip flash memory
section 17 rom rev.7.00 feb. 14, 2007 page 748 of 1108 rej09b0089-0700 h8s/2319 c f-ztat socket adapter (40-pin conversion) tfp-100b pin name 32 33 34 35 36 37 38 39 41 42 43 44 45 46 47 48 50 51 52 53 99 23 24 25 26 27 28 29 30 55 54 56 60 62 66 67 other tlp-113v k4 l5 h5 j5 k5 l6 h6 h7 k6 j6 j7 l8 k7 k8 j9 k9 l10 k11 l11 j11 b2 j2 k2 k1 l2 l1 l3 h3 l4 h11 j8 j10 g8 f11 f10 f9 other fp-100a 34 35 36 37 38 39 40 41 43 44 45 46 47 48 49 50 52 53 54 55 1 25 26 27 28 29 30 31 32 57 56 58 62 64 68 69 other a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 d8 d9 d10 d11 d12 d13 d14 d15 ce oe we v cl * 3 res xtal extal nc(open) hn27c4096hg (40 pins) pin no. pin name 21 22 23 24 25 26 27 28 29 31 32 33 34 35 36 37 38 39 10 9 8 19 18 17 16 15 14 13 12 2 20 3 4 1, 40 11, 30 5, 6, 7 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 i/o0 i/o1 i/o2 i/o3 i/o4 i/o5 i/o6 i/o7 ce oe we fwe v cc v ss nc 40. 63, 64, 65, 74, 77, 78, 98, 59 42, 65, 66, 67, 76, 79, 80, 100, 61 v cc 7, 18, 31, 49, 57, 58, 61, 68, 75, 76, 87, 88, 90 a9, a11, b3, b10, e8, e11, f8, g11, l7 a6, a10, b7, b11, d2, d5, e9, g3, g10, h9, h10, j4, k3, k10 9, 20, 33, 51, 59, 60, 63, 70, 77, 78, 89, 90, 92 v ss reset circuit capacitor oscillator circuit legend: i/o7 to i/o0: data i/o a20 to a0: address input ce : chip enable oe : output enable we : write enable * 1 * 2 notes: this drawing indicates pin correspondences and does not show the entire circuitry of the socket adapter. 1. a reset oscillation stabilization time (t osc1 ) of at least 10 ms is required. 2. a 12-mhz crystal resonator should be used. 3. connect the v cl pin to v ss with a 0.1- f (provisional) capacitor. figure 17.81 pin arrangem ent of the socket adapter
section 17 rom rev.7.00 feb. 14, 2007 page 749 of 1108 rej09b0089-0700 17.28.2 prom mode operation table 17.57 shows the settings for the operating modes of prom mode, and table 17.58 lists the commands used in prom mode. the following sections provide detailed information on each mode. ? memory-read mode: this mode supports reading, in units of bytes, from the user mat or user boot mat. ? auto-program mode: this mode supports the simultaneous programming of the user mat and user boot mat in 128-byte units. status polling is used to confirm the end of automatic programming. ? auto-erase mode: this mode only supports the automatic erasing of the entire user mat or user boot mat. status polling is used to confirm the end of automatic erasing. ? status-read mode: status polling is used with automatic programming and automatic erasure. normal completion can be detected by reading the signal on the i/o 6 pin. in status-read mode, error information is output when an error has occurred. table 17.57 settings for each operating mode of prom mode pin name mode ce oe we i/o7 to 0 a18 to 0 read l l h data output ain output disable l h h hi-z x command write l h l data input ain * 2 chip disable * 1 h x x hi-z x notes: 1. the chip-disable mode is not a standby state; internally, it is an operational state. 2. ain indicates that there is also an address input in auto-program mode.
section 17 rom rev.7.00 feb. 14, 2007 page 750 of 1108 rej09b0089-0700 table 17.58 commands in prom mode 1st cycle 2nd cycle command number of cycles memory mat to be accessed mode address data mode address data 1+n user mat write x h'00 read ra dout memory-read mode user boot mat write x h'05 129 user mat write x h'40 write wa din auto-program mode user boot mat write x h'45 2 user mat write x h'20 write x h'20 auto-erase mode user boot mat write x h'25 h'25 status-read mode 2 common to both mats write x h'71 write x h'71 notes: 1. in auto-program mode, 129 cycles are required in command writing because of the simultaneous 128-byte write. 2. in memory read mode, the number of cycles varies with the number of address writing cycles (n). 17.28.3 memory-read mode (1) on completion of an automatic program, automatic erase, or status read, the lsi enters a command waiting state. so, to r ead the contents of memory after these operations, issue the command to change the mode to the memory-read mode before reading from the memory. (2) in memory-read mode, the writing of commands is possible in the same way as in the command-write state. (3) after entering memory-read mode, continuous reading is possible. (4) after power has first been supplied, the lsi enters the memory-read mode. for the ac characteristics in memory read mode, see section 17.29.2, ac characteristics and timing in prom mode.
section 17 rom rev.7.00 feb. 14, 2007 page 751 of 1108 rej09b0089-0700 17.28.4 auto-program mode (1) in auto-program mode, programming is in 128-byte units. that is, 128 bytes of data are transferred in succession. (2) even in the programming of less than 128 bytes, 128 bytes of data must be transferred. h'ff should be written to those addresses that are unnecessarily written to. (3) set the low seven bits of the address to be transferred to low level. inputting an invalid address will result in a programming error, although processing will proceed to the memory- programming operation. (4) the memory address is transferred in the 2nd cycle. do not transfer addresses in the 3rd or later cycles. (5) do not issue commands while programming is in progress. (6) when programming, execute automatic programming once for each 128-byte block of addresses. programming the block at an address where programming has already been performed is not possible. (7) to confirm the end of automatic programming, check the signal on the i/o 6 pin. confirmation in the status-read mode is also possible (status polling of the i/o 7 pin is used to check the end status of automatic programming). (8) status-polling information on the i/o 6 and i/o 7 pins is retained until the next command is written. as long as no command is written, the information is made readable by setting ce and oe for enabling. for the ac characteristics in auto-program mode , see section 17.29.2, ac characteristics and timing in prom mode. 17.28.5 auto-erase mode (1) auto-erase mode only supports erasing of the entire memory. (2) do not perform command writing during auto erasing is in progress. (3) to confirm the end of automatic erasing, check the signal on the i/o 6 pin. confirmation in the status-read mode is also possible (status polling of the i/o 7 pin is used to check the end status of automatic erasure). (4) status polling information on the i/o 6 and i/o 7 pins is retained until the next command writing. as long as no command is written, the information is made readable by setting ce and oe for enabling. for the ac characteristics in auto-erase mode, see section 17.29.2, ac characteristics and timing in prom mode.
section 17 rom rev.7.00 feb. 14, 2007 page 752 of 1108 rej09b0089-0700 17.28.6 status-read mode (1) status-read mode is used to determine the ty pe of an abnormal termination. use this mode when automatic programming or automatic erasure ends abnormally. (2) the return code is retained until writing of a command that selects a mode other than status- read mode. table 17.59 lists the return codes of status-read mode. for the ac characteristics in status-read mode, see section 17.29.2, ac characteristics and timing in prom mode. table 17.59 return codes of status-read mode pin name i/o 7 i/o 6 i/o 5 i/o 4 i/o 3 i/o 2 i/o 1 i/o 0 attribute normal end indicator command error programming error erase error ? ? programming or erase count exceeded invalid address error initial value 0 0 0 0 0 0 0 0 indication normal end: 0 abnormal end: 1 command error: 1 otherwise: 0 programming error: 1 otherwise: 0 erase error:1 otherwise: 0 ? ? count exceeded: 1 otherwise: 0 invalid address error: 1 otherwise: 0 note: i/o 3 and i/o 2 are undefined pins. 17.28.7 status polling (1) the i/o 7 status-polling output is a flag that indicates the operating status in auto-program or auto-erase mode. (2) the i/o 6 status-polling output is a flag that indicates normal/abnormal end of auto-program or auto-erase mode. table 17.60 truth table of status-polling output pin name in progress abnormal end ? normal end i/o 7 0 1 0 1 i/o 6 0 0 1 1 i/o 0 to i/o 5 0 0 0 0
section 17 rom rev.7.00 feb. 14, 2007 page 753 of 1108 rej09b0089-0700 17.28.8 time taken in transition to prom mode until oscillation has stabilized and while prom mode is being set up, the lsi is unable to accept commands. after the prom-mode setup time has elapsed, the lsi enters memory-read mode. see section 17.29.2, ac characteristics and timing in prom mode. 17.28.9 notes on using prom mode (1) when programming addresses which have previously been programmed, apply auto-erasing before auto-programming. (2) when using prom mode to program a chip that has been programmed/erased in an on-board programming mode, auto-erasing before auto-programming is recommended. (3) do not take the chip out of the prom programmer or reset the chip during programming or erasure. flash memory is susceptible to permanent damage since a high voltage is being applied during the programming/erasing. when the reset signal is accidentally input to the chip, the period in the reset state until the reset signal is released should be longer than the normal 100 s. (4) the flash memory is initially in the erased state when the device is shipped by renesas technology. for other chips for which the history of erasure is unknown, auto-erasing as a check and supplement for the initialization (erase) level is recommended. (5) this lsi does not support modes such as the product identification mode of general purpose eprom. therefore, the device name is not automatically set in the prom programmer. (6) for further information on the writer programmer and its software version, please refer to the instruction manual for the socket adapter.
section 17 rom rev.7.00 feb. 14, 2007 page 754 of 1108 rej09b0089-0700 17.29 further information 17.29.1 serial communication interf ace specification for boot mode initiating boot mode enables the boot program to communicate with the host by using the internal sci. the serial communication interface specification is shown below. status the boot program has three states. (1) bit-rate-adjustment state in this state, the boot program adjusts the bit rate to communicate with the host. initiating boot mode enables starting of the boot program and entry to the bit-rate-adjustment state. the program receives the command from the host to adjust the bit rate. after adjusting the bit rate, the program enters the inquiry/selection state. (2) inquiry/selection state in this state, the boot program responds to inquiry commands from the host. the device name, clock mode, and bit rate are selected. after selection of these settings, the program is made to enter the programming/erasing state by the command for a transition to the programming/erasing state. the program transfers the libraries required for erasure to the on- chip ram and erases the user mats and user boot mats before the transition. (3) programming/erasing state programming and erasure by the boot program take place in this state. the boot program is made to transfer the programming/erasing programs to the on-chip ram by commands from the host. sum checks and blank checks are executed by sending these commands from the host. these boot program states are shown in figure 17.82.
section 17 rom rev.7.00 feb. 14, 2007 page 755 of 1108 rej09b0089-0700 transition to programming/erasing inquiry/selection wait programming/erasing selection wait checking inquiry selection erasing programming reset b it-rate-adjustment state operations for erasing user mats and user b oot mats operations for inquiry operations for selection operations for programming operations for checking operations for erasing figure 17.82 boot program states bit-rate-adjustment state the bit rate is calculated by measuring the period of transfer of a low-level byte (h'00) from the host. the bit rate can be changed by the command for a new bit rate selection. after the bit rate has been adjusted, the boot program enters the inquiry and selection state. the bit-rate-adjustment sequence is shown in figure 17.83.
section 17 rom rev.7.00 feb. 14, 2007 page 756 of 1108 rej09b0089-0700 host b oot program h' 00 (3 0 times maximum) h'e6 (response to b oot) measuring the 1- b it length h' 00 (completion of adjustment) h'55 h'ff (error) figure 17.83 bit-rate-adjustment sequence communications protocol after adjustment of the bit rate, the protocol for communications between the host and the boot program is as shown below. (1) one-byte commands and one-byte responses these commands and responses are comprised of a single byte. these are consists of the inquiries and the ack for successful completion. (2) n-byte commands or n-byte responses these commands and responses are comprised of n bytes of data. these are selections and responses to inquiries. the amount of programming data is not included under this heading because it is determined in another command. (3) error response the error response is a response to inquiries. it consists of an error response and an error code and comes two bytes. (4) programming of n bytes the size is not specified in commands. the size of n is indicated in response to the programming unit inquiry. (5) memory read response this response consists of four bytes of data.
section 17 rom rev.7.00 feb. 14, 2007 page 757 of 1108 rej09b0089-0700 command or response size data checksum error response error code command or response error response n- b yte command or n- b yte response one- b yte command or one- b yte response address command data (n bytes) checksum 128- b yte programming size response data checksum memory read response figure 17.84 communication protocol format ? command (1 byte): commands including inquiries, selection, programming, erasing, and checking ? response (1 byte): response to an inquiry ? size (1 byte): the amount of data for transmission excluding the command, amount of data, and checksum ? checksum (1 byte): the checksum is calculated so that the total of all values from the command byte to the sum byte becomes h'00 ? data (n bytes): detailed data of a command or response ? error response (1 byte): error response to a command ? error code (1 byte): type of the error ? address (4 bytes): address for programming ? data (n bytes): data to be programmed (the size is indicated in the response to the programming unit inquiry.) ? size (4 bytes): four-byte response to a memory read
section 17 rom rev.7.00 feb. 14, 2007 page 758 of 1108 rej09b0089-0700 inquiry and selection states the boot program returns information from the flash memory in response to the host's inquiry commands and sets the device code, clock mode, and bit rate in response to the host's selection command. inquiry and selection commands are listed below. table 17.61 inquiry and selection commands command command name description h'20 supported device inquiry inquiry regarding device codes and product names of f-ztat h'10 device selection selection of device code h'21 clock mode inquiry inquiry regarding numbers of clock modes and values of each mode h'11 clock mode selection indication of the selected clock mode h'22 multiplication ratio inquiry inquiry regarding the number of frequency- multiplied clock types, the number of multiplication ratios, and the values of each multiple h'23 operating clock frequency inquiry inquiry regarding the maximum and minimum values of the main clock and peripheral clocks h'24 user boot mat information inquiry inquiry regarding the number of user boot mats and the start and last addresses of each mat h'25 user mat information inquiry inquiry regarding the a number of user mats and the start and last addresses of each mat h'26 block for erasing information inquiry inquiry regarding the number of blocks and the start and last addresses of each block h'27 programming unit inquiry inquiry regarding the unit of programming data h'3f new bit rate selection selection of new bit rate h'40 transition to programming/erasing state erasing of user mat and user boot mat, and entry to programming/erasing state h'4f boot program status inquiry inquiry into the operated status of the boot program the selection commands, which are device selection (h'10), clock mode selection (h'11), and new bit rate selection (h'3f), should be sent from the host in that order. these commands will certainly be needed. when two or more selection commands are sent at once, the last command will be valid.
section 17 rom rev.7.00 feb. 14, 2007 page 759 of 1108 rej09b0089-0700 all of these commands, except for the boot program status inquiry command (h'4f), will be valid until the boot program receives the programming/erasing transition (h'40). the host can choose the needed commands out of the commands and inquiries listed above. the boot program status inquiry command (h'4f) is valid after the boot program has received the programming/erasing transition command (h'40). (1) supported device inquiry the boot program will return the device codes of supported devices and the product code of the f-ztat in response to the supported device inquiry. command h'20 ? command, h'20, (1 byte): inquiry regarding supported devices response h'30 size a number of devices a number of characters device code product name sum ? response, h'30, (1 byte): response to the supported device inquiry ? size (1 byte): number of bytes to be transmitted, excluding the command, amount of data, and checksum, that is, the amount of data contributes by the product names, the number of devices, characters, and device codes ? a number of devices (1 byte): the number of device types supported by the boot program ? a number of characters (1 byte): the number of characters in the device codes and boot program's name ? device code (4 bytes): code of the supporting product ? product name (n bytes): type name of the boot program in ascii-coded characters ? sum (1 byte): checksum the checksum is calculated so that the total number of all values from the command byte to the sum byte becomes h'00. (2) device selection the boot program will set the supported device to the specified device code. the program will return the selected device code in response to the inquiry after this setting has been made. command h'10 size device code sum ? command, h'10, (1 byte): device selection ? size (1 byte): amount of device-code data this is fixed to 4
section 17 rom rev.7.00 feb. 14, 2007 page 760 of 1108 rej09b0089-0700 ? device code (4 bytes): device code returned in response to the supported device inquiry (ascii-code) ? sum (1 byte): checksum response h'06 ? response, h'06, (1 byte): response to the device selection command ack will be returned when the device code matches. error response h'90 error ? error response, h'90, (1 byte): error response to the device selection command ? error: (1 byte): error code h'11: sum check error h'21: device code error, that is, the device code does not match (3) clock mode inquiry the boot program will return the supported clock modes in response to the clock mode inquiry. command h'21 ? command, h'21, (1 byte): inquiry regarding clock mode response h'31 size mode sum ? response, h'31, (1 byte): response to the clock-mode inquiry ? size (1 byte): amount of data that represents the modes ? mode (1 byte): values of the supported clock modes (i.e. h'01 means clock mode 1.) ? sum (1 byte): checksum (4) clock mode selection the boot program will set the specified clock mode. the program will return the selected clock- mode information after this setting has been made. the clock-mode selection command should be sent after the device-selection commands. command h'11 size mode sum ? command, h'11, (1 byte): selection of clock mode ? size (1 byte): amount of data that represents the modes ? mode (1 byte): a clock mode returned in reply to the supported clock mode inquiry. ? sum (1 byte): checksum
section 17 rom rev.7.00 feb. 14, 2007 page 761 of 1108 rej09b0089-0700 response h'06 ? response, h'06, (1 byte): response to the clock mode selection command ack will be returned when the clock mode matches. error response h'91 error ? error response, h'91, (1 byte): error response to the clock mode selection command ? error, (1 byte) : error code h'11: checksum error h'22: clock mode error, that is, the clock mode does not match. even when the clock mode value is h'00 or h'01 for clock mode inquiry, clock mode selection is performed for each value. (5) multiplication ratio-inquiry the boot program will return the supported multiplication and division ratios. command h'22 ? command, h'22, (1 byte): inquiry regarding multiplication ratio response h'32 size the num ber of clock the number of multiplication ratios multiplica- tion ratio sum ? response, h'32, (1 byte): response to the multiplication ratio inquiry ? size (1 byte): the amount of data that represents the clock sources, the number of multiplication ratios, and the multiplication ratios ? a number of types (1 byte): the number of supported multiplied clock types (e.g. when there are two multiplied clock types, which are the main and peripheral clocks, the number of types will be h'02.) ? a number of multiplication ratios (1 byte): the number of multiplication ratios for each type (e.g. the number of multiplication ratios to which the main clock can be set and the peripheral clock can be set.) ? multiplication ratio (1 byte) ? multiplication ratio: the value of the multiplication ratio (e.g. when the clock-frequency multiplier is four, the value of multiplication ratio will be h'04.)
section 17 rom rev.7.00 feb. 14, 2007 page 762 of 1108 rej09b0089-0700 ? division ratio: the inverse of the division ratio, i.e. a negative number (e.g. when the clock is divided by two, the value of division ratio will be h'fe. h'fe = d'-2) the number of multiplication ratios returned is the same as the number of multiplication ratios and as many groups of data are returned as there are types. ? sum (1 byte): checksum (6) operating clock frequency inquiry the boot program will return the number of operating clock frequencies, and the maximum and minimum values. command h'23 ? command, h'23, (1 byte): inquiry regarding operating clock frequencies response h'33 size a number of operating clock frequencies the minimum value of operating clock frequency the maximum value of operating clock frequency sum ? response, h'33, (1 byte): response to operating clock frequency inquiry ? size (1 byte): the number of bytes that represents the minimum values, maximum values, and the number of types. ? a number of types (1 byte): the number of supported operating clock frequency types (e.g. when there are two operating clock frequency types, which are the main and peripheral clocks, the number of types will be h'02.) ? minimum value of operating clock frequency (2 bytes): the minimum value of the multiplied or divided clock frequency. the minimum and maximum values represent the values in mhz, valid to the hundredths place of mhz, and multiplied by 100. (e.g. when the value is 20.00 mhz, it will be d'2000 and h'07d0.) ? maximum value (2 bytes) : maximum value among the multiplied or divided clock frequencies. there are as many pairs of minimum and maximum values as there are operating clock frequencies. ? sum (1 byte): checksum
section 17 rom rev.7.00 feb. 14, 2007 page 763 of 1108 rej09b0089-0700 (7) user boot mat information inquiry the boot program will return the number of user boot mats and their addresses. command h'24 ? command, h'24, (1 byte): inquiry regarding user boot mat information response h'34 size a number of areas area-start address area-last address sum ? response, h'34, (1 byte): response to user boot mat information inquiry ? size (1 byte): the number of bytes that represents the number of areas, area-start addresses, and area-last address ? a number of areas (1 byte): the number of non-consecutive user boot mat areas when user boot mat areas are consecutive, the number of areas returned is h'01. ? area-start address (1 byte): start address of the area ? area-last address (1 byte): last address of the area there are as many groups of data representing the start and last addresses as there are areas. ? sum (1 byte): checksum (8) user mat information inquiry the boot program will return the number of user mats and their addresses. command h'25 ? command, h'25, (1 byte): inquiry regarding user mat information response h'35 size a number of areas area-start address area-last address sum ? response, h'35, (1 byte): response to the user mat information inquiry ? size (1 byte): the number of bytes that represents the number of areas, area-start address and area-last address ? a number of areas (1 byte): the number of non-consecutive user mat areas when the user mat areas are consecutive, the number of areas is h'01. ? area-start address (4 bytes): start address of the area
section 17 rom rev.7.00 feb. 14, 2007 page 764 of 1108 rej09b0089-0700 ? area-last address (4 bytes): last address of the area there are as many groups of data representing the start and last addresses as there are areas. ? sum (1 byte): checksum (9) erased block information inquiry the boot program will return the number of erased blocks and their addresses. command h'26 ? command, h'26, (1 byte): inquiry regarding erased block information response h'36 size a number of blocks block start address block last address sum ? response, h'36, (1 byte): response to the number of erased blocks and addresses ? size (1 byte): the number of bytes that represents the number of blocks, block-start addresses, and block-last addresses. ? a number of blocks (1 byte): number of erased blocks in flash memory ? block start address (4 bytes) : start address of a block ? block last address (4 bytes) : last address of a block there are as many groups of data representing the start and last addresses as there are blocks. ? sum: checksum (10) programming unit inquiry the boot program will return the programming unit used to program data. command h'27 ? command, h'27, (1 byte): inquiry regarding programming unit response h'37 size programming unit sum ? response, h'37, (1 byte): response to programming unit inquiry ? size (1 byte): the number of bytes that indicate the programming unit, which is fixed to 2 ? programming unit (2 bytes): a unit for programming this is the unit for reception of programming. ? sum (1 byte): checksum
section 17 rom rev.7.00 feb. 14, 2007 page 765 of 1108 rej09b0089-0700 (11) new bit-rate selection the boot program will set a new bit rate and return the new bit rate. this selection should be sent after sending the clock mode selection command. command h'3f size bit rate input frequency number of multiplication ratios multiplication ratio 1 multiplication ratio 2 sum ? command, h'3f, (1 byte): selection of new bit rate ? size (1 byte): the number of bytes that represents the bit rate, input frequency, number of multiplication ratios, and multiplication ratio ? bit rate (2 bytes): new bit rate one hundredth of the value (e.g. when the value is 19200 bps, the bit rate is h'00c0, which is d'192.) ? input frequency (2 bytes): frequency of the clock input to the boot program this is valid to the hundredths place and repres ents the value in mhz multiplied by 100. (e.g. when the value is 20.00 mhz, the input frequency is h'07d0 (= d'2000).) ? number of multiplication ratios (1 byte): the number of multiplication ratios to which the device can be set. normally the value is two: main operating frequency and peripheral module operating frequency. ? multiplication ratio 1 (1 byte): the value of multiplication or division ratios for the main operating frequency ? multiplication ratio (1 byte): the value of the multiplication ratio (e.g. when the clock frequency is multiplied by four, the multiplication ratio will be h'04. with this lsi it should be set to h'01.) ? division ratio: the inverse of the division ratio, as a negative number (e.g. when the clock frequency is divided by two, the value of division ratio will be h'fe. h'fe = d'-2. with this lsi it should be set to h'01.) ? multiplication ratio 2 (1 byte): the value of multiplication or division ratios for the peripheral frequency ? multiplication ratio (1 byte): the value of the multiplication ratio (e.g. when the clock frequency is multiplied by four, the multiplication ratio will be h'04. with this lsi it should be set to h'01.) ? division ratio: the inverse of the division ratio, as a negative number (e.g. when the clock is divided by two, the value of division ratio will be h'fe. h'fe = d'-2. with this lsi it should be set to h'01.) ? sum (1 byte): checksum
section 17 rom rev.7.00 feb. 14, 2007 page 766 of 1108 rej09b0089-0700 response h'06 ? response, h'06, (1 byte): response to selection of a new bit rate when it is possible to set the bit rate, the response will be ack. error response h'bf error ? error response, h'bf, (1 byte): error response to selection of new bit rate ? error: (1 byte): error code h'11: sum checking error h'24: bit-rate selection error the rate is not available. h'25: error in input frequency this input frequency is not within the specified range. h'26: multiplication-ratio error * the ratio does not match an available ratio. h'27: operating frequency error * the frequency is not within the specified range. note: * this error does not occur with this lsi. received data check the methods for checking of received data are listed below. (1) input frequency the received value of the input frequency is checked to ensure that it is within the range of minimum to maximum frequencies which matches the clock modes of the specified device. when the value is out of this range, an input-frequency error is generated. (2) multiplication ratio the received value of the multiplication ratio or divi sion ratio is checked to ensure that it matches the clock modes of the specified device. when the value is out of this range, an input-frequency error is generated.
section 17 rom rev.7.00 feb. 14, 2007 page 767 of 1108 rej09b0089-0700 (3) operating frequency error operating frequency is calculated from the received value of the input frequency and the multiplication or division ratio. the input frequency is input to the lsi and the lsi is operated at the operating frequency. the expression is given below. operating frequency = input frequency multiplication ratio , or operating frequency = input frequency division ratio the calculated operating frequency should be checked to ensure that it is within the range of minimum to maximum frequencies which are available with the clock modes of the specified device. when it is out of this range, an operating frequency error is generated. (4) bit rate peripheral operating clock ( ), bit rate (b), clock select (cks) in the serial mode register (smr). the error as calculated by the method below is checked to ensure that it is less than 4%. when it is 4% or more, a bit-rate selection error is generated. error (%) = {[ ] ? 1} * 1 00 (n+1) * b * 64 * 2 (2 * n ? 1) * 1 0 6 when the new bit rate is selectable, the rate will be set in the register after sending ack in response. the host will send an ack with the new bit rate for confirmation and the boot program will response with that rate. confirmation h'06 ? confirmation, h'06, (1 byte): confirmation of a new bit rate response h'06 ? response, h'06, (1 byte): response to confirmation of a new bit rate the sequence of new bit-rate selection is shown in figure 17.85.
section 17 rom rev.7.00 feb. 14, 2007 page 768 of 1108 rej09b0089-0700 host b oot program setting a new bit rate h' 0 6 (ack) waiting for one-bit period at the specified bit rate h' 0 6 (ack) with the new bit rate h' 0 6 (ack) with the new bit rate setting a new bit rate setting a new bit rate figure 17.85 new bit-rate selection sequence transition to programming/erasing state the boot program will transfer the erasing program, and erase the user mats and user boot mats in that order. on completion of this erasure, ack will be returned and will enter the programming/erasing state. the host should select the device code, clock mode, and new bit rate with device selection, clock- mode selection, and new bit-rate selection commands, and then send the command for the transition to programming/erasing state. these pr ocedure should be carried out before sending of the programming selection command or program data. command h'40 ? command, h'40, (1 byte): transition to programming/erasing state response h'06 ? response, h'06, (1 byte): response to transition to programming/erasing state the boot program will send ack when the user mat and user boot mat have been erased by the transferred erasing program. error response h'c0 h'51 ? error response, h'c0, (1 byte): error response for user boot mat blank check ? error code, h'51, (1 byte): erasing error an error occurred and erasure was not completed.
section 17 rom rev.7.00 feb. 14, 2007 page 769 of 1108 rej09b0089-0700 command error a command error will occur when a command is undefined, the order of commands is incorrect, or a command is unacceptable. issuing a clock-m ode selection command before a device selection or an inquiry command after the transition to programming/erasing state command, are examples. error response h'80 h'xx ? error response, h'80, (1 byte): command error ? command, h'xx, (1 byte): received command command order the order for commands in the inquiry selection state is shown below. (1) a supported device inquiry (h'20) should be made to inquire about the supported devices. (2) the device should be selected from among those described by the returned information and set with a device-selection (h'10) command. (3) a clock-mode inquiry (h'21) should be made to inquire about the supported clock modes. (4) the clock mode should be selected from among those described by the returned information and set. (5) after selection of the device and clock mode, inquiries for other required information should be made, such as the multiplication-ratio inquiry (h'22) or operating frequency inquiry (h'23). (6) a new bit rate should be selected with the ne w bit-rate selection (h'3f) command, according to the returned information on multiplication ratios and operating frequencies. (7) after selection of the device and clock mode, the information of the user boot mat and user mat should be made to inquire about the user boot mats information inquiry (h'24), user mats information inquiry (h'25), erased block information inquiry (h'26), programming unit inquiry (h'27). (8) after making inquiries and selecting a new bit rate, issue the transition to programming/erasing state (h'40) command. the boot program will then enter the programming/erasing state. programming/erasing state a programming selection command makes the boot program select the programming method, an n-byte programming command makes it program the memory with data, and an erasing selection command and block erasing command make it erase the block. the programming/erasing commands are listed below.
section 17 rom rev.7.00 feb. 14, 2007 page 770 of 1108 rej09b0089-0700 table 17.62 programming/erasing command command command name description h'42 user boot mat programming selection t ransfers the user boot mat programming program h'43 user mat programming selection transfers the user mat programming program h'50 128-byte programming programs 128 bytes of data h'48 erasing selection transfers the erasing program h'58 block erasing erases a block of data h'52 memory read reads the contents of memory h'4a user boot mat sum check checks the checksum of the user boot mat h'4b user mat sum check checks the checksum of the user mat h'4c user boot mat blank check checks whether the contents of the user boot mat are blank h'4d user mat blank check checks whether the contents of the user mat are blank h'4f boot program status inquiry inquires into the boot program's status (1) programming programming is executed by a programming-selection command and an 128-byte programming command. firstly, the host should send the programming-selection command and select the programming method and programming mats. there are two programming selection commands, and selection is according to the area and method for programming. ? user boot mat programming selection ? user mat programming selection after issuing the programming selection command, the host should send the 128-byte programming command. the 128-byte programming command that follows the selection command represents the data programmed accordi ng to the method specified by the selection command. when more than 128-byte data is programmed, 128-byte commands should repeatedly be executed. sending an 128-byte programming command with h'ffffffff as the address will stop the programming. on completion of programming, the boot program will wait for selection of programming or erasing.
section 17 rom rev.7.00 feb. 14, 2007 page 771 of 1108 rej09b0089-0700 where the sequence of programming operations that is executed includes programming with another method or of another mat, the procedure must be repeated from the programming selection command. the sequence for programming-selection and 128-byte programming commands is shown in figure 17.86. transfer of the programming program host b oot program programming selection (h'42, h'43, h'44) ack programming 128-byte programming (address, data) ack 128-byte programming (h'ffffffff) ack repeat figure 17.86 programming sequence (2) user boot mat programming selection the boot program will transfer a programming program. the data is programmed to the user boot mats by the transferred programming program. command h'42 ? command, h'42, (1 byte): user boot-program programming selection response h'06 ? response, h'06, (1 byte): response to user boot-program programming selection when the programming program has been transferred, the boot program will return ack. error response h'c2 error ? error response: h'c2 (1 byte): error response to user boot mat programming selection ? error: (1 byte): error code h'54: selection processing error (transfer error occurs and processing is not completed)
section 17 rom rev.7.00 feb. 14, 2007 page 772 of 1108 rej09b0089-0700 (3) user mat programming selection. the boot program will transfer a programming program. the data is programmed to the user mats by the transferred programming program. command h'43 ? command, h'43, (1 byte): user-program programming selection response h'06 ? response, h'06, (1 byte): response to user-program programming selection when the programming program has been transferred, the boot program will return ack. error response h'c3 error ? error response: h'c3 (1 byte): error response to user mat programming selection ? error: (1 byte): error code h'54: selection processing error (transfer error occurs and processing is not completed) (4) 128-byte programming the boot program will use the programming program transferred by the programming selection to program the user boot mats or user mats. command h'50 address data sum ? command, h'50, (1 byte): 128-byte programming ? programming address (4 bytes): start address for programming multiple of the size specified in response to the programming unit inquiry (i.e. h'00, h'01, h'00, h'00: h'01000000) ? programming data (128 bytes): data to be programmed the size is specified in the response to the programming unit inquiry. ? sum (1 byte): checksum response h'06 ? response, h'06, (1 byte): response to 128-byte programming on completion of programming, the boot program will return ack.
section 17 rom rev.7.00 feb. 14, 2007 page 773 of 1108 rej09b0089-0700 error response h'd0 error ? error response, h'd0, (1 byte): error response for 128-byte programming ? error: (1 byte): error code h'11: checksum error h'2a: address error the address is not within the specified range. h'53: programming error a programming error has occurred and programming cannot be continued. the specified address should match the unit for programming of data. for example, when the programming is in 128-byte units, the lower byte of the address should be h'00 or h'80. when there are less than 128 bytes of data to be programmed, the host should fill the rest with h'ff. sending the 128-byte programming command with the address of h'ffffffff will stop the programming operation. the boot program will interpret this as the end of the programming and wait for selection of programming or erasing. command h'50 address sum ? command, h'50, (1 byte): 128-byte programming ? programming address (4 bytes): end code is h'ff, h'ff, h'ff, h'ff. ? sum (1 byte): checksum response h'06 ? response: h'06 (1 byte): response to 128-byte programming on completion of programming, the boot program will return ack. error response h'd0 error ? error response, h'd0, (1 byte): error response for 128-byte programming error: (1 byte): error code h'11: checksum error h'53: programming error an error has occurred in programming and programming cannot be continued.
section 17 rom rev.7.00 feb. 14, 2007 page 774 of 1108 rej09b0089-0700 erasure erasure is performed with the erasure selection and block erasure command. firstly, erasure is selected by the erasure selection command and the boot program then erases the specified block. the command should be repeatedly executed if two or more blocks are to be erased. sending a block-erasure command from the host with the block number h'ff will stop the erasure operating. on completion of erasing, the boot program will wait for selection of programming or erasing. the sequences of the issuing of erasure selection commands and the erasure of data are shown in figure 17.87. transfer of erasure program host b oot program preparation for erasure (h'48) ack erasure erasure (erased b lock number) erasure (h'ff) ack ack repeat figure 17.87 erasure sequence (1) erasure selection the boot program will transfer the erasure program. user mat data is erased by the transferred erasure program. command h'48 ? command, h'48, (1 byte): erasure selection response h'06 ? response, h'06, (1 byte): response for erasure selection after the erasure program has been transferred, the boot program will return ack.
section 17 rom rev.7.00 feb. 14, 2007 page 775 of 1108 rej09b0089-0700 error response h'c8 error ? error response: h'c8 (1 byte): error response to erasing selection ? error: (1 byte): error code h'54: selection processing error (transfer error occurs and processing is not completed) (2) block erasure the boot program will erase the contents of the specified block. command h'58 size block number sum ? command, h'58, (1 byte): erasure ? size (1 byte): the number of bytes that represents the erasure block number this is fixed to 1. ? block number (1 byte): number of the block to be erased ? sum (1 byte): checksum response h'06 ? response, h'06, (1 byte): response to erasure after erasure has been completed, the boot program will return ack. error response h'd8 error ? error response, h'd8, (1 byte): error code ? error: (1 byte): error code h'11: sum check error h'29: block number error block number is incorrect. h'51: erasure error an error has occurred during erasure. on receiving block number h'ff, the boot program will stop erasure and wait for a selection command. command h'58 size block number sum ? command, h'58, (1 byte): erasure ? size, (1 byte): the number of bytes that represents the block number this is fixed to 1.
section 17 rom rev.7.00 feb. 14, 2007 page 776 of 1108 rej09b0089-0700 ? block number (1 byte): h'ff stop code for erasure ? sum (1 byte): checksum response h'06 ? response, h'06, (1 byte): response to end of erasure (ack) when erasure is to be performed after the block number h'ff has been sent, the procedure should be executed from the erasure selection command. memory read the boot program will return the data in the specified address. command h'52 size area read address read size sum ? command: h'52 (1 byte): memory read ? size (1 byte): amount of data that represents th e area, read address, and read size (fixed at 9) ? area (1 byte) h'00: user boot mat h'01: user mat an address error occurs when the area setting is incorrect. ? read address (4 bytes): start address to be read from ? read size (4 bytes): size of data to be read ? sum (1 byte): checksum response h'52 read size data sum ? response: h'52 (1 byte): response to memory read ? read size (4 bytes): size of data to be read ? data (n bytes): data for the read size from the read address ? sum (1 byte): checksum error response h'd2 error ? error response: h'd2 (1 byte): error response to memory read ? error: (1 byte): error code h'11: sum check error
section 17 rom rev.7.00 feb. 14, 2007 page 777 of 1108 rej09b0089-0700 h'2a: address error the read address is not in the mat. h'2b: size error the read size exceeds the mat. user-boot program sum check the boot program will return the byte-by-byte total of the contents of the bytes of the user-boot program. command h'4a ? command, h'4a, (1 byte): sum check for user-boot program response h'5a size checksum of user boot program sum ? response, h'5a, (1 byte): response to the sum check of user-boot program ? size (1 byte): the number of bytes that represents the checksum this is fixed to 4. ? checksum of user boot program (4 bytes): checksum of user boot mats the total of the data is obtained in byte units. ? sum (1 byte): sum check for data being transmitted user-program sum check the boot program will return the byte-by-byte total of the contents of the bytes of the user program. command h'4b ? command, h'4b, (1 byte): sum check for user program response h'5b size checksum of user program sum ? response, h'5b, (1 byte): response to the sum check of the user program ? size (1 byte): the number of bytes that represents the checksum this is fixed to 4. ? checksum of user boot program (4 bytes): checksum of user mats the total of the data is obtained in byte units. ? sum (1 byte): sum check for data being transmitted
section 17 rom rev.7.00 feb. 14, 2007 page 778 of 1108 rej09b0089-0700 user boot mat blank check the boot program will check whether or not all user boot mats are blank and return the result. command h'4c ? command, h'4c, (1 byte): blank check for user boot mat response h'06 ? response, h'06, (1 byte): response to the blank check of user boot mat if all user mats are blank (h'ff), the boot program will return ack. error response h'cc h'52 ? error response, h'cc, (1 byte): response to blank check for user boot mat ? error code, h'52, (1 byte): erasure has not been completed. user mat blank check the boot program will check whether or not all user mats are blank and return the result. command h'4d ? command, h'4d, (1 byte): blank check for user mats response h'06 ? response, h'06, (1 byte): response to the blank check for user boot mats if the contents of all user mats are blank (h'ff), the boot program will return ack. error response h'cd h'52 ? error response, h'cd, (1 byte) : error response to the blank check of user mats. ? error code h'52 (1 byte): erasure has not been completed.
section 17 rom rev.7.00 feb. 14, 2007 page 779 of 1108 rej09b0089-0700 boot program state inquiry the boot program will return indications of its pr esent state and error condition. this inquiry can be made in the inquiry/selection state or the programming/erasing state. command h'4f ? command, h'4f, (1 byte): inquiry regarding boot program's state response h'5f size status error sum ? response, h'5f, (1 byte): response to boot program state inquiry ? size (1 byte): the number of bytes that represents the status and error. this is fixed to 2. ? status (1 byte): state of the boot program for details, see table 17.63. ? error (1 byte): error state error = 0 indicates normal operation. error = 1 indicates error has occurred for details, see table 17.64. ? sum (1 byte): checksum
section 17 rom rev.7.00 feb. 14, 2007 page 780 of 1108 rej09b0089-0700 table 17.63 status code code description h'11 device selection wait h'12 clock mode selection wait h'13 bit rate selection wait h'if programming/erasing state transition wa it (bit rate selection is completed) h'31 programming state for erasure h'3f programming/erasing selection wait (erasure is completed) h'4f programming data receive wait (programming is completed) h'5f erasure block specification wait (erasure is completed) table 17.64 error code code description h'00 no error h'11 sum check error h'12 program size error h'21 device code mismatch error h'22 clock mode mismatch error h'24 bit rate selection error h'25 input frequency error h'26 multiplication ratio error h'27 operating frequency error h'29 block number error h'2a address error h'2b data length error h'51 erasure error h'52 erasure incompletion error h'53 programming error h'54 selection error h'80 command error h'ff bit-rate-adjustment confirmation error
section 17 rom rev.7.00 feb. 14, 2007 page 781 of 1108 rej09b0089-0700 17.29.2 ac characteristics and timing in prom mode table 17.65 ac characteristics in memory read mode condition: v cc = 3.3 v 0.3 v, v ss = 0 v, t a = 25 ? c 5 ? c code symbol min max unit command write cycle t nxtc 20 ? s ce hold time t ceh 0 ? ns ce setup time t ces 0 ? ns data hold time t dh 50 ? ns data setup time t ds 50 ? ns programming pulse width t wep 70 ? ns we rise time t r ? 30 ns we fall time t f ? 30 ns c e a18- 0 i/o7- 0 o e w e command write t ceh t ds t dh tf tr t nxtc note : data is latched at the rising edge of w e . t ces t wep memory read mode address stable figure 17.88 memory read timing after command write
section 17 rom rev.7.00 feb. 14, 2007 page 782 of 1108 rej09b0089-0700 table 17.66 ac characteristics in transition from memory read mode to others condition: v cc = 3.3 v 0.3 v, v ss = 0 v, t a = 25 ? c 5 ? c code symbol min max unit command write cycle t nxtc 20 ? s ce hold time t ceh 0 ? ns ce setup time t ces 0 ? ns data hold time t dh 50 ? ns data setup time t ds 50 ? ns programming pulse width t wep 70 ? ns we rise time t r ? 30 ns we fall time t f ? 30 ns c e a18- 0 i/o7- 0 o e w e other mode command write t ceh t ds t dh tf tr t nxtc note : w e and o e should not be enabled simultaneously. t ces t wep memory read mode address stable figure 17.89 timing at transition from memory read mode to other modes
section 17 rom rev.7.00 feb. 14, 2007 page 783 of 1108 rej09b0089-0700 table 17.67 ac characteristics memory read mode condition: v cc = 3.3 v 0.3 v, v ss = 0 v, t a = 25 ? c 5 ? c code symbol min max unit access time t acc ? 20 s ce output delay time t ce ? 150 ns oe output delay time t oe ? 150 ns output disable delay time t df ? 100 ns data output hold time t oh 5 ? ns c e a18- 0 i/o7- 0 o e w e v ih v il v il t acc t oh t oh t acc address stable address stable figure 17.90 ce / oe enable state read c e a18- 0 i/o7- 0 v ih o e w e t ce t acc t oe t oh t oh t df t ce t acc t oe address stable address stable t df figure 17.91 ce / oe clock read
section 17 rom rev.7.00 feb. 14, 2007 page 784 of 1108 rej09b0089-0700 table 17.68 ac characteristics auto-prom mode condition: v cc = 3.3 v 0.3 v, v ss = 0 v, t a = 25 ? c 5 ? c code symbol min max unit command write cycle t nxtc 20 ? s ce hold time t ceh 0 ? ns ce setup time t ces 0 ? ns data hold time t dh 50 ? ns data setup time t ds 50 ? ns programming pulse width t wep 70 ? ns status polling start time t wsts 1 ? ms status polling access time t spa ? 150 ns address setup time t as 0 ? ns address hold time t ah 60 ? ns memory programming time t write 1 3000 ms we rise time t r ? 30 ns we fall time t f ? 30 ns address stable c e a18- 0 i/o5- 0 i/o6 i/o7 o e w e t as t ah t dh t ds tf tr t wep t wsts t write t spa t nxtc t nxtc t ceh t ces identification signal of programming operation end data transfer 1 byte to 128 bytes identification signal of programming operation successful end h'4 0 or h'45 h' 00 1st byte din 128th byte din figure 17.92 timing in auto-prom mode
section 17 rom rev.7.00 feb. 14, 2007 page 785 of 1108 rej09b0089-0700 table 17.69 ac characteristics auto-erase mode condition: v cc = 3.3 v 0.3 v, v ss = 0 v, t a = 25 ? c 5 ? c code symbol min max unit command write cycle t nxtc 20 ? s ce hold time t ceh 0 ? ns ce setup time t ces 0 ? ns data hold time t dh 50 ? ns data setup time t ds 50 ? ns programming pulse width t wep 70 ? ns status polling start time t ests 1 ? ms status polling access time t spa ? 150 ns memory erase time t erase 100 40000 ms we rise time t r ? 30 ns we fall time t f ? 30 ns c e a18- 0 i/o5- 0 i/o6 i/o7 o e w e t ests t erase t spa t dh t ds tf tr t wep t nxtc t nxtc t ceh t ces erase end identification signal erase normal and confirmation signal h'2 0 or h'25 h' 00 h'2 0 or h'25 figure 17.93 timing in auto-erase mode
section 17 rom rev.7.00 feb. 14, 2007 page 786 of 1108 rej09b0089-0700 table 17.70 ac characteristics status read mode condition: v cc = 3.3 v 0.3 v, v ss = 0 v, t a = 25 ? c 5 ? c code symbol min max unit command write cycle t nxtc 20 ? s ce hold time t ceh 0 ? ns ce setup time t ces 0 ? ns data hold time t dh 50 ? ns data setup time t ds 50 ? ns programming pulse width t wep 70 ? ns oe output delay time t oe ? 150 ns disable delay time t df ? 100 ns ce output delay time t ce ? 150 ns we rise time t r ? 30 ns we fall time t f ? 30 ns c e a18- 0 i/o7- 0 o e w e t dh t df t ds tf tr t wep t nxtc t nxtc tf tr t wep t ds t dh t nxtc t ceh t ceh t oe t ces t ces t ce h'71 h'71 note: i/o 3 and i/o 2 are undefined. figure 17.94 timing in status read mode table 17.71 stipulated transition times to command wait state code symbol min max unit standby release (oscillation settling time) t osc1 30 ? ms prom mode setup time t bmv 10 ? ms v cc hold time t dwn 0 ? ms
section 17 rom rev.7.00 feb. 14, 2007 page 787 of 1108 rej09b0089-0700 v cc r e s memory read mode command wait state command wait state normal/abnormal end identification auto-program mode auto-erase mode t osc1 t bmv t dwn command acceptance figure 17.95 oscillation stabilization time, prom mode setup time, and power-down sequence 17.29.3 procedure program and storable area for programming data in the descriptions in the previous section, the programming/erasing procedure programs and storable areas for program data are assumed to be in the on-chip ram. however, the program and the data can be stored in and executed from other areas, such as part of flash memory which is not to be programmed or erased, or somewhere in the external address space. conditions that apply to programming/erasing (1) the on-chip programming/erasing program is downloaded from the address set by ftdar in on-chip ram, therefore, this area is not available for use. (2) the on-chip programming/erasing program will use the 128 bytes as a stack. so, make sure that this area is secured. (3) since download by setting the sco bit to 1 will cause the mats to be switched, it should be executed in on-chip ram. (4) the flash memory is accessible until the start of programming or erasing, that is, until the result of downloading has been judged. when in a mode in which the external address space is not accessible, such as single-chip mode, the required procedure programs should be transferred to the on-chip ram before programming/erasing of the flash memory starts. (5) the flash memory is not accessible during programming/erasing operations, therefore, the operation program is downloaded to the on-chip ram to be executed. the programs such as that which activate the operation program, should thus be stored in on-chip memory other than flash memory or the external address space. (6) after programming/erasing, the flash memory should be inhibited until fkey is cleared. the reset state (res = 0) must be in place for more than 100 s when the lsi mode is changed to reset on completion of a programming/erasing operation.
section 17 rom rev.7.00 feb. 14, 2007 page 788 of 1108 rej09b0089-0700 transitions to the reset state, and hardware standby mode are inhibited during programming/erasing. when the reset signal is accidentally input to the chip, a longer period in the reset state than usual (100 s) is needed before the reset signal is released. (7) switching of the mats by fmats should be needed when programming/erasing of the user boot mat is operated in user-boot mode. the program which switches the mats should be executed from the on-chip ram. see section 17.27, switching between user mat and user boot mat. please make sure you know which mat is selected when switching between them. (8) when the data storable area indicated by programming parameter fmpdr is within the flash memory area, an error will occur even when the data stored is normal. therefore, the data should be transferred to the on-chip ram to place the address that fmpdr indicates in an area other than the flash memory. in consideration of these conditions, there are three factors; operating mode, the bank structure of the user mat, and operations. the areas in which the programming data can be stored for execution are shown in table 17.26. table 17.72 executable mat initiated modes operation user program mode user boot mode * programming table 17.73 (1) table 17.73 (3) erasing table 17.73 (2) table 17.73 (4) note: * programming/erasing is possible to user mats.
section 17 rom rev.7.00 feb. 14, 2007 page 789 of 1108 rej09b0089-0700 table 17.73 (1) usable area for programming in user program mode storable/executable area selected mat item on-chip ram user mat external space (expanded mode) user mat embedded program storage area storage area for program data * ? ? operation for selection of on-chip program to be downloaded operation for writing h'a5 to key register execution of writing sc0 = 1 to fccs (download) operation for key register clear judgement of download result programming procedure operation for download error operation for settings of initial parameter execution of initialization judgement of initialization result operation for initialization error operation for inhibit of interrupt operation for writing h'5a to key register operation for settings of program parameter execution of programming judgement of program result operation for program error operation for key register clear note: * transferring the data to the on-chip ram enables this area to be used.
section 17 rom rev.7.00 feb. 14, 2007 page 790 of 1108 rej09b0089-0700 table 17.73 (2) usable area for erasure in user program mode storable/executable area selected mat item on-chip ram user mat external space (expanded mode) user mat embedded program storage area operation for selection of on-chip program to be downloaded operation for writing h'a5 to key register execution of writing sc0 = 1 to fccs (download) operation for key register clear erasing procedure judgement of download result operation for download error operation for settings of default parameter execution of initialization judgement of initialization result operation for initialization error operation for inhibit of interrupt operation for writing h'5a to key register operation for settings of erasure parameter execution of erasure judgement of erasure result operation for erasure error operation for key register clear
section 17 rom rev.7.00 feb. 14, 2007 page 791 of 1108 rej09b0089-0700 table 17.73 (3) usable area for programming in user boot mode storable/executable area selected mat item on-chip ram user boot mat external space (expanded mode) user mat user boot mat embedded program storage area storage area for program data * 1 ? ? ? operation for selection of on-chip program to be downloaded operation for writing h'a5 to key register execution of writing sc0 = 1 to fccs (download) operation for key register clear judgement of download result programming procedure operation for download error operation for settings of default parameter execution of initialization judgement of initialization result operation for initialization error operation for interrupt inhibit switching mats by fmats operation for writing h'5a to key register operation for settings of program parameter execution of programming judgement of program result operation for program error * 2 operation for key register clear switching mats by fmats notes: 1. transferring the data to the on-chip ram enables this area to be used. 2. switching fmats by a program in the on-chip ram enables this area to be used.
section 17 rom rev.7.00 feb. 14, 2007 page 792 of 1108 rej09b0089-0700 table 17.73 (4) usable area for erasure in user boot mode storable/executable area selected mat item on-chip ram user boot mat external space (expanded mode) user mat user boot mat embedded program storage area operation for selection of on-chip program to be downloaded operation for writing h'a5 to key register execution of writing sc0 = 1 to fccs (download) operation for key register clear erasing procedure judgement of download result operation for download error operation for settings of default parameter execution of initialization judgement of initialization result operation for initialization error operation for interrupt inhibit switching mats by fmats operation for writing h'5a to key register operation for settings of erasure parameter execution of erasure judgement of erasure result operation for erasure error * operation for key register clear switching mats by fmats note: * switching fmats by a program in the on-chip ram enables this area to be used.
section 18 clock pulse generator rev.7.00 feb. 14, 2007 page 793 of 1108 rej09b0089-0700 section 18 clock pulse generator 18.1 overview the chip has an on-chip clock pulse generator (cpg) that generates the system clock ( ), the bus master clock, and internal clocks. the clock pulse generator consists of an oscillator circuit, a duty adjustment circuit, a medium- speed clock divider, and a bus master clock selection circuit. in the chip, the cpg has a medium-speed mode in which the bus master runs on a medium-speed clock and the other supporting modules run on the high-speed clock, and a function that allows the medium-speed mode to be disabled and the clock division ratio to be changed for the entire chip. a clock from /2 to /32 can be selected. 18.1.1 block diagram figure 18.1 shows a block diagram of the clock pulse generator. extal xtal duty adjustment circuit oscillator medium- speed clock divider system clock to pin internal clock to supporting modules bus master clock to cpu and dtc /2 to /32 div sck2 to sck0 sckcr bus master clock selection circuit figure 18.1 block diagram of clock pulse generator
section 18 clock pulse generator rev.7.00 feb. 14, 2007 page 794 of 1108 rej09b0089-0700 18.1.2 register configuration the clock pulse generator is controlled by sckcr. table 18.1 shows the register configuration. table 18.1 clock pulse generator register name abbreviation r/w initial value address * system clock control register sckcr r/w h'00 h'ff3a note: * lower 16 bits of the address. 18.2 register descriptions 18.2.1 system clock control register (sckcr) bit : 7 6 5 4 3 2 1 0 pstop ? div ? ? sck2 sck1 sck0 initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w ? ? r/w r/w r/w sckcr is an 8-bit readable/wr itable register that controls clock output, the medium-speed mode in which the bus master runs on a medium-speed clock and the other supporting modules run on the high-speed clock, and a function that allows the medium-speed mode to be disabled and the clock division ratio to be changed for the entire chip. sckcr is initialized to h'00 by a reset and in hardware standby mode. it is not initialized in software standby mode. bit 7? clock output disable (pstop): controls output. description bit 7 pstop normal operation sleep mode software standby mode hardware standby mode 0 output (initial value) output fixed high high impedance 1 fixed high fixed high fixed high high impedance bit 6?reserved: this bit can be read or written to, but only 0 should be written.
section 18 clock pulse generator rev.7.00 feb. 14, 2007 page 795 of 1108 rej09b0089-0700 bit 5?division ra tio select (div): when the div bit is set to 1, the medium-speed mode is disabled and a clock obtained using the division ratio set with bits sck2 to sck0 is supplied to the entire chip. in this way, the current dissipation within the chip is reduced in proportion to the division ratio. as the frequency of changes, the following points must be noted. ? the division ratio set with bits sck2 to sck0 should be selected so as to fall within the guaranteed operation range of clock cycle time tcyc given in the ac timing table in the electrical characteristics section. ensure that min = 2 mhz, and the condition < 2 mhz does not arise. ? all internal modules basically operate on . note, therefore, that time processing involving the timers, the sci, etc., will change when the division ratio changes. the wait time when software standby is cleared will also change in line with a change in the division ratio. ? the division ratio can be changed while the chip is operating. the clock output from the pin will also change when the division ratio is changed. the frequency of the clock output from the pin in this case will be as follows: = extal n where: extal: crystal resonator or external clock frequency n: division ratio (n = /2, /4, or /8) ? do not set the div bit and bits sck2 to sck0 simultaneously. first set the div bit, then bits sck2 to sck0. bit 5 div description 0 when bits sck2 to sck0 are set to other than high-speed mode, medium-speed mode is set (initial value) 1 when bits sck2 to sck0 are set to other than high-speed mode, a divided clock is supplied to the entire chip bits 4 and 3?reserved: these bits cannot be modified and are always read as 0. bits 2 to 0?system clock select 2 to 0 (sck2 to sck0): when the div bit is cleared to 0, these bits select the medium-speed mode; when the div bit is set to 1, they select the division ratio of the clock supplied to the entire chip.
section 18 clock pulse generator rev.7.00 feb. 14, 2007 page 796 of 1108 rej09b0089-0700 description bit 2 sck2 bit 1 sck1 bit 0 sck0 div = 0 div = 1 0 0 0 bus master is in high-speed mode (initial value) bus master is in high-speed mode (initial value) 1 medium-speed clock is /2 clock supplied to entire chip is /2 1 0 medium-speed clock is /4 clock supplied to entire chip is /4 1 medium-speed clock is /8 clock supplied to entire chip is /8 1 0 0 medium-speed clock is /16 ? 1 medium-speed clock is /32 ? 1 ? ? ? 18.3 oscillator clock pulses can be supplied by connecting a crystal resonator, or by input of an external clock. 18.3.1 connecting a crystal resonator circuit configuration: a crystal resonator can be connected as shown in the example in figure 18.2. select the damping resistance r d according to table 18.2. an at-cut parallel-resonance crystal should be used. extal xtal r d c l2 c l1 c l1 = c l2 = 10 to 22 pf figure 18.2 connection of crystal resonator (example) table 18.2 damping resistance value frequency (mhz) 2 4 8 12 16 20 25 r d ( ) 6.8 k 500 200 0 0 0 0
section 18 clock pulse generator rev.7.00 feb. 14, 2007 page 797 of 1108 rej09b0089-0700 crystal resonator: figure 18.3 shows the equivalent circuit of the crystal resonator. use a crystal resonator that has the characteristics shown in table 18.3 and the same resonance frequency as the system clock ( ). xtal c l at-cut parallel-resonance type extal c 0 lr s figure 18.3 crystal resonator equivalent circuit table 18.3 crystal resonator characteristics frequency (mhz) 2 4 8 12 16 20 25 r s max ( ) 500 120 80 60 50 40 40 c 0 max (pf) 7 7 7 7 7 7 7 notes on board design: when a crystal resonator is connected, the following points should be noted: other signal lines should be routed away from the oscillator circuit to prevent induction from interfering with correct oscillation. see figure 18.4. when designing the board, place the crystal resonato r and its load capacitors as close as possible to the xtal and extal pins. c l2 signal a signal b c l1 chip xtal extal a void figure 18.4 example of incorrect board design
section 18 clock pulse generator rev.7.00 feb. 14, 2007 page 798 of 1108 rej09b0089-0700 18.3.2 external clock input circuit configuration: an external clock signal can be input as shown in the examples in figure 18.5. if the xtal pin is left open, make sure that stray capacitance is no more than 10 pf. in example (b), make sure that the external clock is held high in standby mode. extal xtal external clock inpu t open (a) xtal pin left open extal xtal external clock inpu t (b) complementary clock input at xtal pin figure 18.5 external clock input (examples)
section 18 clock pulse generator rev.7.00 feb. 14, 2007 page 799 of 1108 rej09b0089-0700 external clock: the external clock signal should have the same frequency as the system clock ( ). table 18.4 and figure 18.6 show the input conditions for the external clock. table 18.4 external clock input conditions v cc = 2.7 v to 3.3 v v cc = 3.0 v to 3.6 v item symbol min max min max unit test conditions external clock input low pulse width t exl 20 ? 10 ? ns external clock input high pulse width t exh 20 ? 10 ? ns external clock rise time t exr ? 5 ? 5 ns external clock fall time t exf ? 5 ? 5 ns figure 18.6 0.4 0.6 0.4 0.6 t cyc 5 mhz clock low pulse width level t cl 80 ? 80 ? ns < 5 mhz 0.4 0.6 0.4 0.6 t cyc 5 mhz clock high pulse width level t ch 80 ? 80 ? ns < 5 mhz figure 20.2 t exh t exl t exr t exf v cc 0.5 extal figure 18.6 external clock input timing
section 18 clock pulse generator rev.7.00 feb. 14, 2007 page 800 of 1108 rej09b0089-0700 18.4 duty adjustment circuit when the oscillator frequency is 5 mhz or higher, the duty adjustment circuit adjusts the duty cycle of the clock signal from the oscillator to generate the system clock ( ). 18.5 medium-speed clock divider the medium-speed clock divider divides the system clock to generate /2, /4, /8, /16, and /32. 18.6 bus master clock selection circuit the bus master clock selection circuit selects the system clock ( ) or one of the medium-speed clocks ( /2, /4, /8, /16, or /32) to be supplied to the bus master, according to the settings of the sck2 to sck0 bits in sckcr.
section 19 power-down modes rev.7.00 feb. 14, 2007 page 801 of 1108 rej09b0089-0700 section 19 power-down modes 19.1 overview in addition to the normal program execution state, the chip has five power-down modes in which operation of the cpu and oscillator is halted and power dissipation is reduced. low-power operation can be achieved by individually controlling the cpu, on-chip supporting modules, and so on. the chip operating modes are as follows: 1. high-speed mode 2. medium-speed mode 3. sleep mode 4. module stop mode 5. software standby mode 6. hardware standby mode of these, 2 to 6 are power-down modes. sleep mode is a cpu mode, medium-speed mode is a cpu and bus master mode, and module stop mode is an on-chip supporting module mode (including bus masters other than the cpu). a combination of these modes can be set. after a reset, the chip is in high-speed mode. table 19.1 shows the conditions for transition to the various modes, the status of the cpu, on-chip supporting modules, etc., and the method of clearing each mode.
section 19 power-down modes rev.7.00 feb. 14, 2007 page 802 of 1108 rej09b0089-0700 table 19.1 operating modes cpu modules operating mode transition condition clearing condition oscillator register s registers i/o ports high speed mode control register control register functions high speed function high speed function high speed medium- speed mode control register control register functions medium speed function high/ medium speed * 1 function high speed sleep mode instruction interrupt functions halted retained high speed function high speed module stop mode control register control register functions high/ medium speed function halted retained/ reset * 2 retained software standby mode instruction external interrupt halted halted retained halted retained/ reset * 2 retained hardware standby mode pin pin halted halted undefined halted reset high impedance notes: 1. the bus master operates on the medium-speed clock, and other on-chip supporting modules on the high-speed clock. 2. some sci registers and the a/d converter are reset, and other on-chip supporting modules retain their states. 19.1.1 register configuration power-down modes are controlled by the sbycr, sckcr, and mstpcr registers. table 19.2 summarizes these registers. table 19.2 power-down mode registers name abbreviation r/w initial value address * standby control register sbycr r/w h'08 h'ff38 system clock control register sckcr r/w h'00 h'ff3a module stop control register h mstpcrh r/w h'3f h'ff3c module stop control register l mstpcrl r/w h'ff h'ff3d note: * lower 16 bits of the address.
section 19 power-down modes rev.7.00 feb. 14, 2007 page 803 of 1108 rej09b0089-0700 19.2 register descriptions 19.2.1 standby control register (sbycr) bit : 7 6 5 4 3 2 1 0 ssby sts2 sts1 sts0 ope ? ? irq37s initial value : 0 0 0 0 1 0 0 0 r/w : r/w r/w r/w r/w r/w ? ? r/w sbycr is an 8-bit readable/writable register th at performs software standby mode control. sbycr is initialized to h'08 by a reset and in hardware standby mode. it is not initialized in software standby mode. bit 7?software standby (ssby): specifies a transition to software standby mode. remains set to 1 when software standby mode is released by an external interrupt, and a transition is made to normal operation. the ssby bit should be cleared by writing 0 to it. bit 7 ssby description 0 transition to sleep mode after execution of sleep instruction (initial value) 1 transition to software standby mode after execution of sleep instruction bits 6 to 4?standby timer select 2 to 0 (sts2 to sts0): these bits select the time the mcu waits for the clock to stabilize when software standby mode is cleared by an external interrupt. with crystal oscillation, refer to table 19.4 and make a selection according to the operating frequency so that the standby time is at least 8 ms (the oscillation stabilization time). with an external clock, any selection can be made * . note: * except in the f-ztat versions.
section 19 power-down modes rev.7.00 feb. 14, 2007 page 804 of 1108 rej09b0089-0700 bit 6 sts2 bit 5 sts1 bit 4 sts0 description 0 0 0 standby time = 8192 states (initial value) 1 standby time = 16384 states 1 0 standby time = 32768 states 1 standby time = 65536 states 1 0 0 standby time = 131072 states 1 standby time = 262144 states 1 0 reserved 1 standby time = 16 states * note: * not available in the f-ztat versions. bit 3?output port enable (ope): specifies whether the output of the address bus and bus control signals ( cs0 to cs7 , as , rd , hwr , lwr , cas ) is retained or set to the high-impedance state in software standby mode. bit 3 ope description 0 in software standby mode, address bus and bus control signals are high-impedance 1 in software standby mode, address bus and bus control signals retain output state (initial value) bits 2 and 1?reserved: these bits cannot be modified and are always read as 0. bit 0?irq37 software standby clear select (irq37s): specifies whether inputs irq3 to irq7 can be used as software standby mode clearing sources in addition to the usual sources, nmi and irq0 to irq2 inputs. bit 0 irq37s description 0 inputs irq3 to irq7 cannot be used as software standby mode clearing sources (initial value) 1 inputs irq3 to irq7 can be used as software standby mode clearing sources
section 19 power-down modes rev.7.00 feb. 14, 2007 page 805 of 1108 rej09b0089-0700 19.2.2 system clock control register (sckcr) bit : 7 6 5 4 3 2 1 0 pstop ? div ? ? sck2 sck1 sck0 initial value : 0 0 0 0 0 0 0 0 r/w : r/w r/w r/w ? ? r/w r/w r/w sckcr is an 8-bit readable/wr itable register that controls clock output, the medium-speed mode in which the bus master runs on a medium-speed clock and the other supporting modules run on the high-speed clock, and a function that allows the medium-speed mode to be disabled and the clock division ratio to be changed for the entire chip. sckcr is initialized to h'00 by a reset and in hardware standby mode. it is not initialized in software standby mode. bit 7? clock output disable (pstop): controls output. description bit 7 pstop normal operating mode sleep mode software standby mode hardware standby mode 0 output (initial value) output fixed high high impedance 1 fixed high fixed high fixed high high impedance bit 6?reserved: this bit can be read or written to, but only 0 should be written. bit 5?division ratio select (div): when the div bit is set to 1, the medium-speed mode is disabled and a clock obtained using the division ratio set with bits sck2 to sck0 is supplied to the entire chip. in this way, the current dissipation within the chip is reduced in proportion to the division ratio. as the frequency of changes, the following points must be noted. ? the division ratio set with bits sck2 to sck0 should be selected so as to fall within the guaranteed operation range of clock cycle time tcyc given in the ac timing table in the electrical characteristics section. ensure that min = 2 mhz, and the condition < 2 mhz does not arise. ? all internal modules basically operate on . note, therefore, that time processing involving the timers, the sci, etc., will change when the division ratio changes. the wait time when software standby is cleared will also change in line with a change in the division ratio.
section 19 power-down modes rev.7.00 feb. 14, 2007 page 806 of 1108 rej09b0089-0700 ? the division ratio can be changed while the chip is operating. the clock output from the pin will also change when the division ratio is changed. the frequency of the clock output from the pin in this case will be as follows: = extal n where: extal: crystal resonator or external clock frequency n: division ratio (n = /2, /4, or /8) ? do not set the div bit and bits sck2 to sck0 simultaneously. first set the div bit, then bits sck2 to sck0. bit 5 div description 0 when bits sck2 to sck0 are set to other than high-speed mode, medium-speed mode is set (initial value) 1 when bits sck2 to sck0 are set to other than high-speed mode, a divided clock is supplied to the entire chip bits 4 and 3?reserved: these bits cannot be modified and are always read as 0. bits 2 to 0?system clock select 2 to 0 (sck2 to sck0): when the div bit is cleared to 0, these bits select the bus master clock; when the div bit is set to 1, they select the division ratio of the clock supplied to the entire chip. description bit 2 sck2 bit 1 sck1 bit 0 sck0 div = 0 div = 1 0 0 0 bus master is in high-speed mode (initial value) bus master is in high-speed mode (initial value) 1 medium-speed clock is /2 clock supplied to entire chip is /2 1 0 medium-speed clock is /4 clock supplied to entire chip is /4 1 medium-speed clock is /8 clock supplied to entire chip is /8 1 0 0 medium-speed clock is /16 ? 1 medium-speed clock is /32 ? 1 ? ? ?
section 19 power-down modes rev.7.00 feb. 14, 2007 page 807 of 1108 rej09b0089-0700 19.2.3 module stop control register (mstpcr) mstpcrh mstpcrl bit : 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value : 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w : r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w mstpcr is a 16-bit readable/writable register that performs module stop mode control. mstpcr is initialized to h'3fff by a reset and in ha rdware standby mode. it is not initialized in software standby mode. bits 15 to 0?module stop (mstp 15 to mstp 0): these bits specify module stop mode. see table 19.3 for the method of selecting on-chip supporting modules. bits 15 to 0 mstp15 to mstp0 description 0 module stop mode cleared 1 module stop mode set 19.3 medium-speed mode when the sck2 to sck0 bits in sckcr are set to 1, the operating mode changes to medium- speed mode as soon as the current bus cycle ends. in medium-speed mode, the cpu operates on the operating clock ( /2, /4, /8, /16, or /32) specified by the sck2 to sck0 bits. the bus masters other than the cpu (the dtc) also operate in medium-speed mode. on-chip supporting modules other than the bus masters always operate on the high-speed clock ( ). in medium-speed mode, a bus access is executed in the specified number of states with respect to the bus master operating clock. for example, if /4 is selected as the operating clock, on-chip memory is accessed in 4 states, and internal i/o registers in 8 states. medium-speed mode is cleared by clearing all of bi ts sck2 to sck0 to 0. a transition is made to high-speed mode and medium-speed mode is cleared at the end of the current bus cycle. if a sleep instruction is executed when the ssby bit in sbycr is cleared to 0, a transition is made to sleep mode. when sleep mode is cleared by an interrupt, medium-speed mode is restored.
section 19 power-down modes rev.7.00 feb. 14, 2007 page 808 of 1108 rej09b0089-0700 if a sleep instruction is executed when the ssby bit in sbycr is set to 1, a transition is made to software standby mode. when software standby mode is cleared by an external interrupt, medium-speed mode is restored. when the res pin is driven low, a transition is made to the reset state, and medium-speed mode is cleared. the same applies in the case of a reset caused by overflow of the watchdog timer. when the stby pin is driven low, a transition is made to hardware standby mode. figure 19.1 shows the timing for transition to and clearance of medium-speed mode. , supporting module clock bus master clock internal address bus internal write signal medium-speed mode sckcr sckcr figure 19.1 medium-speed mode transition and clearance timing 19.4 sleep mode if a sleep instruction is executed when the ssby bit in sbycr is cleared to 0, the cpu enters sleep mode. in sleep mode, cpu operation stops but the contents of the cpu?s internal registers are retained. other supporting modules do not stop. sleep mode is cleared by a reset or any interrupt, and the cpu returns to the normal program execution state via the exception handling state. sleep mode is not cleared if interrupts are disabled, or if interrupts other than nmi are masked by the cpu. when the stby pin is driven low, a transition is made to hardware standby mode.
section 19 power-down modes rev.7.00 feb. 14, 2007 page 809 of 1108 rej09b0089-0700 19.5 module stop mode 19.5.1 module stop mode module stop mode can be set for individual on-chip supporting modules. when the corresponding mstp bit in mstpcr is set to 1, module operation stops at the end of the bus cycle and a transition is made to module stop mode. the cpu continues operating independently. table 19.3 shows mstp bits and the corresponding on-chip supporting modules. when the corresponding mstp bit is cleared to 0, module stop mode is cleared and the module starts operating at the end of the bus cycle. in module stop mode, the internal states of modules other than the sci and a/d converter are retained. after reset clearance, all modules other than dtc are in module stop mode. when an on-chip supporting module is in module stop mode, read/write access to its registers is disabled. do not make a transition to sleep mode with mstpcr set to h'ffff or h'efff, as this will halt operation of the bus controller.
section 19 power-down modes rev.7.00 feb. 14, 2007 page 810 of 1108 rej09b0089-0700 table 19.3 mstp bits and correspo nding on-chip supporting modules register bit module mstpcrh mstp15 ? mstp14 data transfer controller (dtc) mstp13 16-bit timer-pulse unit (tpu) mstp12 8-bit timer module mstp11 ? mstp10 d/a converter (channels 0 and 1) mstp9 a/d converter mstp8 ? mstpcrl mstp7 ? mstp6 serial communication interface (sci) channel 1 mstp5 serial communication interface (sci) channel 0 mstp4 ? mstp3 ? mstp2 ? mstp1 ? mstp0 ? note: bits 15, 11, 8, 7, and 4 to 0 can be read or written to, but do not affect operation. 19.5.2 usage notes dtc module stop: depending on the operating status of the dtc, the mstp14 bit may not be set to 1. setting of the dtc module stop mode should be carried out only when the module is not activated. for details, refer to section 7, data transfer controller. on-chip supporting module interrupts: relevant interrupt operations cannot be performed in module stop mode. consequently, if module stop mode is entered when an interrupt has been requested, it will not be possible to clear the cpu interrupt source or the dtc activation source. interrupts should therefore be disabled before entering module stop mode. writing to mstpcr: mstpcr should only be written to by the cpu.
section 19 power-down modes rev.7.00 feb. 14, 2007 page 811 of 1108 rej09b0089-0700 19.6 software standby mode 19.6.1 software standby mode if a sleep instruction is executed when the ssby bit in sbycr is set to 1, software standby mode is entered. in this mode, the cpu, on-chip supporting modules, and oscillator all stop. however, the contents of the cpu?s internal registers, ram data, and the states of on-chip supporting modules other than the sci and a/d converter, and i/o ports, are retained. whether the address bus and bus control signals are placed in the high-impedance state or retain the output state can be specified by the ope bit in sbycr. see appendix d, pin states, for details. in this mode the oscillator stops, and therefore power dissipation is significantly reduced. 19.6.2 clearing software standby mode software standby mode is cleared by an external interrupt (nmi pin, or pins irq0 to irq7 * ), or by means of the res pin or stby pin. clearing with an interrupt: when an nmi or irq0 to irq7 * interrupt request signal is input, clock oscillation starts, and after the elapse of the time set in bits sts2 to sts0 in syscr, stable clocks are supplied to the entire chip, software standby mode is cleared, and interrupt exception handling is started. when clearing software standby mode with an irq0 to irq7 * interrupt, set the corresponding enable bit to 1 and ensure that no interrupt with a higher priority than interrupts irq0 to irq7 * is generated. software standby mode cannot be cleared if the interrupt has been masked on the cpu side or has been designated as a dtc activation source. note: * setting the irq37s bit to 1 enables irq3 to irq7 to be used as software standby mode clearing sources. clearing with the res pin: when the res pin is driven low, clock oscillation is started. at the same time as clock oscillation starts, clocks are supplied to the entire chip. note that the res pin must be held low until clock oscillation stabilizes. when the res pin goes high, the cpu begins reset exception handling. clearing with the stby pin: when the stby pin is driven low, a transition is made to hardware standby mode.
section 19 power-down modes rev.7.00 feb. 14, 2007 page 812 of 1108 rej09b0089-0700 19.6.3 setting oscillation stabilization time after clearing software standby mode bits sts2 to sts0 in sbycr should be set as described below. using a crystal oscillator: set bits sts2 to sts0 so that the standby time is at least 8 ms (the oscillation stabilization time). table 19.4 shows the standby times for different operating frequencies and settings of bits sts2 to sts0. table 19.4 oscillation stabilization time settings sts2 sts1 sts0 standby time 25 mhz 20 mhz 16 mhz 12 mhz 10 mhz 8 mhz 6 mhz 4 mhz 2 mhz unit 0 0 0 8192 states 0.32 0.41 0.51 0.68 0.8 1.0 1.3 2.0 4.1 ms 1 16384 states 0.65 0.82 1.0 1.3 1.6 2.0 2.7 4.1 8.2 1 0 32768 states 1.3 1.6 2.0 2.7 3.3 4.1 5.5 8.2 16.4 1 65536 states 2.6 3.3 4.1 5.5 6.6 8.2 10.9 16.4 32.8 1 0 0 131072 states 5.2 6.6 8.2 10.9 13.1 16.4 21.8 32.8 65.5 1 262144 states 10.4 13.1 16.4 21.8 26.2 32.8 43.6 65.6 131.2 1 0 reserved ? ? ? ? ? ? ? ? ? ? 1 16 states 0.6 0.8 1.0 1.3 1.6 2.0 2.7 4.0 8.0 s : recommended time setting using an external clock: any value can be set. normally, use of the minimum time is recommended * . note: * the 16-state standby time cannot be used in the f-ztat versions; a standby time of 8192 states or longer should be used. 19.6.4 software standby mode application example figure 19.2 shows an example in which a transition is made to software standby mode at the falling edge on the nmi pin, and software standby mode is cleared at the rising edge on the nmi pin. in this example, an nmi interrupt is accepted with the nmieg bit in syscr cleared to 0 (falling edge specification), then the nmieg bit is set to 1 (rising edge specification), the ssby bit is set to 1, and a sleep instruction is executed, causing a transition to software standby mode.
section 19 power-down modes rev.7.00 feb. 14, 2007 page 813 of 1108 rej09b0089-0700 software standby mode is then cleared at the rising edge on the nmi pin. oscillator nmi nmieg ssby nmi exception handling nmieg=1 ssby=1 sleep instruction software standby mode (power-down mode) oscillation stabilization time t osc2 nmi exception handling figure 19.2 software standby mode application example 19.6.5 usage notes i/o port status: in software standby mode, i/o port states are retained. if the ope bit is set to 1, the address bus and bus control signal output is also retained. therefore, there is no reduction in current dissipation for the output current when a high-level signal is output. current dissipation during oscillation stabilization wait period: current dissipation increases during the oscillation stabilization wait period.
section 19 power-down modes rev.7.00 feb. 14, 2007 page 814 of 1108 rej09b0089-0700 19.7 hardware standby mode 19.7.1 hardware standby mode when the stby pin is driven low, a transition is made to hardware standby mode from any mode. in hardware standby mode, all functions enter the reset state and stop operation, resulting in a significant reduction in power dissipation. as long as the prescribed voltage is supplied, on-chip ram data is retained. i/o ports are set to the high-impedance state. in order to retain on-chip ram data, the rame bit in syscr should be cleared to 0 before driving the stby pin low. do not change the state of the mode pins (md2 to md0) while the chip is in hardware standby mode. hardware standby mode is cleared by means of the stby pin and the res pin. when the stby pin is driven high while the res pin is low, the reset state is set and clock oscillation is started. ensure that the res pin is held low until the clock oscillator stabilizes (at least 8 ms?the oscillation stabilization time?when using a crystal oscillator). when the res pin is subsequently driven high, a transition is made to the program execution state via the reset exception handling state. 19.7.2 hardware standby mode timing figure 19.3 shows an example of hardware standby mode timing. when the stby pin is driven low after the res pin has been driven low, a transition is made to hardware standby mode. hardware standby mode is cleared by driving the stby pin high, waiting for the oscillation stabilization time, then changing the res pin from low to high.
section 19 power-down modes rev.7.00 feb. 14, 2007 page 815 of 1108 rej09b0089-0700 oscillator res stby oscillation stabilization time reset exception handling figure 19.3 hardware standby mode timing 19.8 clock output disabling function output of the clock can be controlled by means of the pstop bit in sckcr, and ddr for the corresponding port. when the pstop bit is set to 1, the clock stops at the end of the bus cycle, and output goes high. clock output is enabled when the pstop bit is cleared to 0. when ddr for the corresponding port is cleared to 0, clock output is disabled and input port mode is set. table 19.5 shows the state of the pin in each processing state. table 19.5 pin state in each processing state ddr 0 1 1 pstop ? 0 1 hardware standby mode high impedance high impedance high impedance software standby mode high impedance fixed high fixed high sleep mode high impedance output fixed high normal operating state high impedance output fixed high
section 19 power-down modes rev.7.00 feb. 14, 2007 page 816 of 1108 rej09b0089-0700
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 817 of 1108 rej09b0089-0700 section 20 electrical characteristics 20.1 electrical characteristics of mask rom version (h8s/2319, h8s/2318, h8s/2317s, h8s/2316s, h8s/2315, h8s/2314) and romless version (h8s/2312s) 20.1.1 absolute maximum ratings table 20.1 lists the absolute maximum ratings. table 20.1 absolute maximum ratings item symbol value unit power supply voltage v cc ?0.3 to +4.3 v input voltage (except port 4) v in ?0.3 to v cc +0.3 v input voltage (port 4) v in ?0.3 to av cc +0.3 v reference power supply voltage v ref ?0.3 to av cc +0.3 v analog power supply voltage av cc ?0.3 to +4.3 v analog input voltage v an ?0.3 to av cc +0.3 v operating temperature t opr regular specifications: ?20 to +75 c wide-range specifications: ?40 to +85 c storage temperature t stg ?55 to +125 c caution: permanent damage to the chip may result if absolute maximum ratings are exceeded.
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 818 of 1108 rej09b0089-0700 20.1.2 dc characteristics table 20.2 dc characteristics conditions: v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v * 1 , t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide- range specifications) item symbol min typ max unit test conditions vt ? v cc 0.2 ? ? v vt + ? ? v cc 0.7 v schmitt trigger input voltage ports 1, 2, irq0 to irq7 vt + ? vt ? v cc 0.07 ? ? v res , stby , nmi, md2 to md0 v cc 0.9 ? v cc + 0.3 v extal v cc 0.7 ? v cc + 0.3 v ports 3, a to g 2.2 ? v cc + 0.3 v input high voltage port 4 v ih 2.2 ? av cc + 0.3 v res , stby , md2 to md0 ?0.3 ? v cc 0.1 v input low voltage nmi, extal, ports 3, 4, a to g v il ?0.3 ? v cc 0.2 v v cc ? 0.5 ? ? v i oh = ?200 a output high voltage all output pins v oh v cc ? 1.0 ? ? v i oh = ?1 ma output low voltage all output pins v ol ? ? 0.4 v i ol = 1.6 ma res ? ? 10.0 a stby , nmi, md2 to md0 ? ? 1.0 a v in = 0.5 v to v cc ? 0.5 v input leakage current port 4 | i in | ? ? 1.0 a v in = 0.5 v to av cc ? 0.5 v three-state leakage current (off state) ports 1, 2, 3, a to g | i tsi | ? ? 1.0 a v in = 0.5 v to v cc ? 0.5 v
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 819 of 1108 rej09b0089-0700 item symbol min typ max unit test conditions input pull-up mos current ports a to e ?i p 10 ? 300 a v in = 0v res ? ? 30 pf v in = 0 v nmi ? ? 30 pf f = 1 mhz input capacitance all input pins except res and nmi c in ? ? 15 pf t a = 25c ? 35 (3.0 v) 80 ma f = 20 mhz normal operation 50 (3.3 v) 100 ma f = 25 mhz ? 25 (3.0 v) 64 ma f = 20 mhz sleep mode 35 (3.3 v) 80 ma f = 25 mhz ? 0.01 10 a t a 50c current dissipation * 2 standby mode * 3 i cc * 4 ? ? 80 a 50c < t a during a/d and d/a conversion ? 0.2 (3.0 v) 2.0 ma analog power supply voltage idle ai cc ? 0.01 5.0 a during a/d and d/a conversion ? 1.4 (3.0 v) 3.0 ma reference power supply voltage idle ai cc ? 0.01 5.0 a ram standby voltage v ram 2.0 ? ? v notes: 1. if the a/d and d/a converters are not used, do not leave the av cc , v ref , and av ss pins open . connect the av cc and v ref pins to v cc , and the av ss pin to v ss . 2. current dissipation values are for v ih min = v cc ? 0.2 v and v il max = 0.2 v with all output pins unloaded and all mos input pull-ups in the off state. 3. the values are for v ram v cc < 2.7 v, v ih min = v cc 0.9, and v il max = 0.3 v. 4. i cc depends on v cc and f as follows: i cc max = 1.0 (ma) + 1.10 (ma/(mhz v)) v cc f (normal operation) i cc max = 1.0 (ma) + 0.88 (ma/(mhz v)) v cc f (sleep mode)
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 820 of 1108 rej09b0089-0700 table 20.3 permissible output currents conditions: v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) item symbol min typ max unit permissible output low current (per pin) all output pins i ol ? ? 2.0 ma permissible output low current (total) total of all output pins i ol ? ? 80 ma permissible output high current (per pin) all output pins ?i oh ? ? 2.0 ma permissible output high current (total) total of all output pins ?i oh ? ? 40 ma note: to protect chip reliability, do not exceed the output current values in table 20.3. 20.1.3 ac characteristics 3 v r l r h c chip output pin c = 50 pf: ports 1, a to f c = 30 pf: ports 2, 3, g r l = 2.4 k r h = 12 k input/output timing measurement level: 1.5 v (v cc = 2.7 v to 3.6 v) figure 20.1 output load circuit
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 821 of 1108 rej09b0089-0700 (1) clock timing table 20.4 clock timing condition a: v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 2 mhz to 20 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) condition a condition b item symbol min max min max unit test conditions clock cycle time t cyc 50 500 40 500 ns clock pulse high width t ch 20 ? 15 ? ns clock pulse low width t cl 20 ? 15 ? ns clock rise time t cr ? 5 ? 5 ns clock fall time t cf ? 5 ? 5 ns figure 20.2 reset oscillation stabilization time (crystal) t osc1 10 ? 10 ? ms figure 20.3 software standby oscillation stabilization time (crystal) t osc2 10 ? 10 ? ms external clock output stabilization delay time t dext 500 ? 500 ? s figure 20.3
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 822 of 1108 rej09b0089-0700 t cr t cl t cf t ch t cyc figure 20.2 system clock timing t osc1 t osc1 extal v cc stby res t dext t dext nmi figure 20.3 oscillation stabilization timing
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 823 of 1108 rej09b0089-0700 (2) control signal timing table 20.5 control signal timing condition a: v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 2 mhz to 20 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) condition a condition b item symbol min max min max unit test conditions res setup time t ress 200 ? 200 ? ns res pulse width t resw 20 ? 20 ? t cyc figure 20.4 nmi setup time t nmis 150 ? 150 ? figure 20.5 nmi hold time t nmih 10 ? 10 ? nmi pulse width (in recovery from software standby mode) t nmiw 200 ? 200 ? ns irq setup time t irqs 150 ? 150 ? ns irq hold time t irqh 10 ? 10 ? irq pulse width (in recovery from software standby mode) t irqw 200 ? 200 ?
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 824 of 1108 rej09b0089-0700 t resw t ress t ress res figure 20.4 reset input timing t irqs irq edge input t irqh t nmis t nmih t irqs irq level input nmi irq t nmiw t irqw figure 20.5 interrupt input timing
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 825 of 1108 rej09b0089-0700 (3) bus timing table 20.6 bus timing condition a: v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 2 mhz to 20 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) condition a condition b item symbol min max min max unit test conditions address delay time t ad ? 20 ? 20 ns figures 20.6 to 20.10 address setup time t as 0.5 t cyc ? 15 ? 0.5 t cyc ? 15 ? ns address hold time t ah 0.5 t cyc ? 10 ? 0.5 t cyc ? 8 ? ns cs delay time 1 t csd1 ? 20 ? 15 ns as delay time t asd ? 20 ? 15 ns rd delay time 1 t rsd1 ? 20 ? 15 ns rd delay time 2 t rsd2 ? 20 ? 15 ns read data setup time t rds 15 ? 15 ? ns read data hold time t rdh 0 ? 0 ? ns read data access time 1 t acc1 ? 1.0 t cyc ? 25 ? 1.0 t cyc ? 20 ns read data access time 2 t acc2 ? 1.5 t cyc ? 25 ? 1.5 t cyc ? 20 ns read data access time 3 t acc3 ? 2.0 t cyc ? 25 ? 2.0 t cyc ? 20 ns read data access time 4 t acc4 ? 2.5 t cyc ? 25 ? 2.5 t cyc ? 20 ns read data access time 5 t acc5 ? 3.0 t cyc ? 25 ? 3.0 t cyc ? 20 ns
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 826 of 1108 rej09b0089-0700 condition a condition b item symbol min max min max unit test conditions wr delay time 1 t wrd1 ? 20 ? 15 ns figures 20.6 to 20.10 wr delay time 2 t wrd2 ? 20 ? 15 ns wr pulse width 1 t wsw1 1.0 t cyc ? 20 ? 1.0 t cyc ? 15 ? ns wr pulse width 2 t wsw2 1.5 t cyc ? 20 ? 1.5 t cyc ? 15 ? ns write data delay time t wdd ? 30 ? 20 ns write data setup time t wds 0.5 t cyc ? 20 ? 0.5 t cyc ? 15 ? ns write data hold time t wdh 0.5 t cyc ? 10 ? 0.5 t cyc ? 8 ? ns wait setup time t wts 30 ? 25 ? ns figure 20.8 wait hold time t wth 5 ? 5 ? ns breq setup time t brqs 30 ? 30 ? ns figure 20.11 back delay time t bacd ? 15 ? 15 ns bus floating time t bzd ? 50 ? 40 ns breqo delay time t brqod ? 30 ? 25 ns figure 20.12
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 827 of 1108 rej09b0089-0700 a 23 to a0 cs7 to cs0 as t rsd2 t as t ah t csd1 t acc2 t rsd1 t asd t asd t ad t acc3 t wrd2 t wrd2 t wsw1 t wdd t wdh t 1 t 2 rd (read) d15 to d0 (read) hwr , lwr (write) d15 to d0 (write) t rds t ah t as t as t rdh figure 20.6 basic bus timing (2-state access)
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 828 of 1108 rej09b0089-0700 a 23 to a0 cs7 to cs0 as t rsd2 t as t ah t csd1 t acc4 t rsd1 t asd t asd t ad t acc5 t wrd2 t wrd1 t wsw2 t wdd t wdh t 1 t 3 rd (read) d15 to d0 (read) hwr , lwr (write) d15 to d0 (write) t wds t 2 t rds t as t ah t rdh figure 20.7 basic bus timing (3-state access)
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 829 of 1108 rej09b0089-0700 a 23 to a0 cs7 to cs0 as t wth t 1 t 2 rd (read) d15 to d0 (read) hwr to lwr (write) d15 to d0 (write) wait t w t 3 t wts t wth t wts figure 20.8 basic bus timing (3-state access, 1 wait)
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 830 of 1108 rej09b0089-0700 a 23 to a0 cs0 as t rsd2 t as t ah t asd t asd t ad t acc3 t rds t rdh t 1 t 2 rd (read) d15 to d0 (read) t 2 or t 3 t 1 figure 20.9 burst rom access timing (2-state access)
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 831 of 1108 rej09b0089-0700 t ad t acc1 t rds t rdh t 1 t 2 or t 3 t 1 a 23 to a0 cs0 as rd (read) d15 to d0 (read) t rsd2 figure 20.10 burst rom access timing (1-state access)
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 832 of 1108 rej09b0089-0700 breq back t bacd t bzd a 23 to a0, cs7 to cs0 , as , rd , hwr , lwr t bacd t bzd t brqs t brqs figure 20.11 external bus release timing breqo t brqod t brqod figure 20.12 external bus request output timing
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 833 of 1108 rej09b0089-0700 (4) timing of on-chip supporting modules table 20.7 timing of on-chip supporting modules condition a: v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 2 mhz to 20 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) condition a condition b item symbol min max min max unit test conditions i/o ports output data delay time t pwd ? 50 ? 40 ns figure 20.13 input data setup time t prs 30 ? 25 ? ns input data hold time t prh 30 ? 25 ? ns tpu timer output delay time t tocd ? 50 ? 40 ns figure 20.14 timer input setup time t tics 30 ? 25 ? ns timer clock input setup time t tcks 30 ? 25 ? ns figure 20.15 single-edge specification t tckwh 1.5 ? 1.5 ? t cyc timer clock pulse width both-edge specification t tckwl 2.5 ? 2.5 ? t cyc 8-bit timer timer output delay time t tmod ? 50 ? 40 ns figure 20.16 timer reset input setup time t tmrs 30 ? 25 ? ns figure 20.18 timer clock input setup time t tmcs 30 ? 25 ? ns figure 20.17 single-edge specification t tmcwh 1.5 ? 1.5 ? t cyc timer clock pulse width both-edge specification t tmcwl 2.5 ? 2.5 ? t cyc wdt overflow output delay time t wovd ? 50 ? 40 ns figure 20.19
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 834 of 1108 rej09b0089-0700 condition a condition b item symbol min max min max unit test conditions sci asynchronous 4 ? 4 ? t cyc figure 20.20 input clock cycle synchronous t scyc 6 ? 6 ? input clock pulse width t sckw 0.4 0.6 0.4 0.6 t scyc input clock rise time t sckr ? 1.5 ? 1.5 t cyc input clock fall time t sckf ? 1.5 ? 1.5 t cyc transmit data delay time t txd ? 50 ? 40 ns figure 20.21 receive data setup time (synchronous) t rxs 50 ? 40 ? ns receive data hold time (synchronous) t rxh 50 ? 40 ? ns a/d converter trigger input setup time t trgs 30 ? 30 ? ns figure 20.22 ports 1 to 4, a to g (read) t prs t 1 t 2 t pwd t prh ports 1 to 3, a to g (write) figure 20.13 i/o port input/output timing
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 835 of 1108 rej09b0089-0700 t tics t tocd output compare output * input capture input * note: * tioca0 to tioca5, tiocb0 to tiocb5, tiocc0, tiocc3, tiocd0, tiocd3 figure 20.14 tpu input/output timing t tcks t tcks tclka to tclkd t tckwh t tckwl figure 20.15 tpu clock input timing t tmod tmo0, tmo1 figure 20.16 8-bit timer output timing
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 836 of 1108 rej09b0089-0700 t tmcs t tmcs tmci0, tmci1 t tmcwh t tmcwl figure 20.17 8-bit timer clock input timing t tmrs tmri0, tmri1 figure 20.18 8-bit timer reset input timing t wovd wdtovf t wovd figure 20.19 wdt output timing t scyc t sckr t sckw sck0, sck1 t sckf figure 20.20 sck clock input timing
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 837 of 1108 rej09b0089-0700 sck0, sck1 txd0, txd1 (transmit data) rxd0, rxd1 (receive data) t txd t rxh t rxs figure 20.21 sci input/output timing (synchronous mode) t trgs adtrg figure 20.22 a/d converter external trigger input timing
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 838 of 1108 rej09b0089-0700 20.1.4 a/d conversion characteristics table 20.8 a/d conversion characteristics condition a: v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 2 mhz to 20 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) condition a condition b item min typ max min typ max unit resolution 10 10 10 10 10 10 bits conversion time 6.7 ? ? 10.6 ? ? s analog input capacitance ? ? 20 ? ? 20 pf permissible signal source impedance ? ? 5 ? ? 5 k nonlinearity error ? ? 5.5 ? ? 5.5 lsb offset error ? ? 5.5 ? ? 5.5 lsb full-scale error ? ? 5.5 ? ? 5.5 lsb quantization error ? ? 0.5 ? ? 0.5 lsb absolute accuracy ? ? 6.0 ? ? 6.0 lsb
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 839 of 1108 rej09b0089-0700 20.1.5 d/a conversion characteristics table 20.9 d/a conversion characteristics condition a: v cc = 2.7 v to 3.6 v, av cc = 2.7 v to 3.6 v, v ref = 2.7 v to av cc , v ss = av ss = 0 v, = 2 mhz to 20 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) condition a condition b item min typ max min typ max unit test conditions resolution 8 8 8 8 8 8 bits conversion time ? ? 10 ? ? 10 s 20-pf capacitive load absolute accuracy ? 2.0 3.0 ? 2.0 3.0 lsb 2-m resistive load ? ? 2.0 ? ? 2.0 lsb 4-m resistive load
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 840 of 1108 rej09b0089-0700 20.2 electrical characteristics of f- ztat versions (h8s/2319 f-ztat, h8s/2319e f-ztat, h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, h8s/2314 f-ztat) 20.2.1 absolute maximum ratings table 20.10 absolute maximum ratings condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) item symbol value unit power supply voltage v cc ?0.3 to +4.3 v input voltage (fwe, emle) v in ?0.3 to v cc +0.3 v input voltage (except port 4) v in ?0.3 to v cc +0.3 v input voltage (port 4) v in ?0.3 to av cc +0.3 v reference power supply voltage v ref ?0.3 to av cc +0.3 v analog power supply voltage av cc ?0.3 to +4.3 v analog input voltage v an ?0.3 to av cc +0.3 v operating temperature t opr regular specifications: ?20 to +75 * c wide-range specifications: ?40 to +85 * c storage temperature t stg ?55 to +125 c caution: permanent damage to the chip may result if absolute maximum ratings are exceeded. note: * condition b: the operating temperature ranges for flash memory programming/erasing are t a = 0c to +75c (regular specifications), and t a = 0c to +85c (wide-range specifications).
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 841 of 1108 rej09b0089-0700 20.2.2 dc characteristics table 20.11 dc characteristics condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v * 1 , t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) item symbol min typ max unit test conditions vt ? v cc 0.2 ? ? v vt + ? ? v cc 0.7 v schmitt trigger input voltage ports 1, 2, irq0 to irq7 vt + ? vt ? v cc 0.07 ? ? v res , stby , nmi, md2 to md0, fwe, emle v cc 0.9 ? v cc + 0.3 v extal v cc 0.7 ? v cc + 0.3 v ports 3, a to g 2.2 ? v cc + 0.3 v input high voltage port 4 v ih 2.2 ? av cc + 0.3 v res , stby , md2 to md0, fwe, emle ?0.3 ? v cc 0.1 v input low voltage nmi, extal, ports 3, 4, a to g v il ?0.3 ? v cc 0.2 v v cc ? 0.5 ? ? v i oh = ?200 a output high voltage all output pins v oh v cc ? 1.0 ? ? v i oh = ?1 ma output low voltage all output pins v ol ? ? 0.4 v i ol = 1.6 ma res ? ? 10.0 a input leakage current stby , nmi, md2 to md0, fwe, emle | i in | ? ? 1.0 a v in = 0.5 v to v cc ? 0.5 v port 4 ? ? 1.0 a v in = 0.5 v to av cc ? 0.5 v
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 842 of 1108 rej09b0089-0700 item symbol min typ max unit test conditions three-state leakage current (off state) ports 1, 2, 3, a to g | i tsi | ? ? 1.0 a v in = 0.5 v to v cc ? 0.5 v input pull-up mos current ports a to e ?i p 10 ? 300 a v cc = 3.0 v to 3.6 v, v in = 0 v res ? ? 30 pf nmi ? ? 30 pf input capacitance all input pins except res and nmi c in ? ? 15 pf v in = 0 v f = 1 mhz t a = 25c normal operation ? 50 (3.3 v) 100 ma sleep mode 35 (3.3 v) 80 ma f = 25 mhz standby mode * 3 ? 0.01 10 a t a 50c current dissipation * 2 i cc * 4 ? ? 80 a 50c < t a during a/d and d/a conversion ? 0.2 (3.0 v) 2.0 ma analog power supply voltage idle ai cc ? 0.01 5.0 a during a/d and d/a conversion ? 1.4 (3.0 v) 3.0 ma reference power supply voltage idle ai cc ? 0.01 5.0 a ram standby voltage v ram 2.0 ? ? v notes: 1. if the a/d and d/a converters are not used, do not leave the av cc , v ref , and av ss pins open . connect the av cc and v ref pins to v cc , and the av ss pin to v ss . 2. current dissipation values are for v ih min = v cc ? 0.2 v and v il max = 0.2 v with all output pins unloaded and all mos input pull-ups in the off state. 3. the values are for v ram v cc < 3.0 v, v ih min = v cc 0.9, and v il max = 0.3 v. 4. i cc depends on v cc and f as follows: i cc max = 1.0 (ma) + 1.10 (ma/(mhz v)) v cc f (normal operation) i cc max = 1.0 (ma) + 0.88 (ma/(mhz v)) v cc f (sleep mode)
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 843 of 1108 rej09b0089-0700 table 20.12 permissible output currents condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, t a = ?20 to +75c (regular specifications), t a = ?40 to +85c (wide-range specifications) item symbol min typ max unit permissible output low current (per pin) all output pins i ol ? ? 2.0 ma permissible output low current (total) total of all output pins i ol ? ? 80 ma permissible output high current (per pin) all output pins ?i oh ? ? 2.0 ma permissible output high current (total) total of all output pins ?i oh ? ? 40 ma note: to protect chip reliability, do not exceed the output current values in table 20.12.
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 844 of 1108 rej09b0089-0700 20.2.3 ac characteristics (1) clock timing table 20.13 clock timing condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) item symbol min max unit test conditions clock cycle time t cyc 40 500 ns figure 20.2 clock pulse high width t ch 15 ? ns clock pulse low width t cl 15 ? ns clock rise time t cr ? 5 ns clock fall time t cf ? 5 ns reset oscillation stabilization time (crystal) t osc1 10 ? ms figure 20.3 software standby oscillation stabilization time (crystal) t osc2 10 ? ms external clock output stabilization delay time t dext 500 ? s figure 20.3
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 845 of 1108 rej09b0089-0700 (2) control signal timing table 20.14 control signal timing condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) item symbol min max unit test conditions res setup time t ress 200 ? ns figure 20.4 res pulse width t resw 20 ? t cyc nmi setup time t nmis 150 ? ns figure 20.5 nmi hold time t nmih 10 ? ns nmi pulse width (in recovery from software standby mode) t nmiw 200 ? ns irq setup time t irqs 150 ? ns irq hold time t irqh 10 ? ns irq pulse width (in recovery from software standby mode) t irqw 200 ? ns
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 846 of 1108 rej09b0089-0700 (3) bus timing table 20.15 bus timing condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) item symbol min max unit test conditions address delay time t ad ? 20 ns figures 20.6 to 20.10 address setup time t as 0.5 t cyc ? 15 ? ns address hold time t ah 0.5 t cyc ? 8 ? ns cs delay time 1 t csd1 ? 15 ns as delay time t asd ? 15 ns rd delay time 1 t rsd1 ? 15 ns rd delay time 2 t rsd2 ? 15 ns read data setup time t rds 15 ? ns read data hold time t rdh 0 ? ns read data access time 1 t acc1 ? 1.0 t cyc ? 20 ns read data access time 2 t acc2 ? 1.5 t cyc ? 20 ns read data access time 3 t acc3 ? 2.0 t cyc ? 20 ns read data access time 4 t acc4 ? 2.5 t cyc ? 20 ns read data access time 5 t acc5 ? 3.0 t cyc ? 20 ns wr delay time 1 t wrd1 ? 15 ns wr delay time 2 t wrd2 ? 15 ns wr pulse width 1 t wsw1 1.0 t cyc ? 15 ? ns wr pulse width 2 t wsw2 1.5 t cyc ? 15 ? ns write data delay time t wdd ? 20 ns write data setup time t wds 0.5 t cyc ? 15 ? ns write data hold time t wdh 0.5 t cyc ? 8 ? ns wait setup time t wts 25 ? ns figure 20.8 wait hold time t wth 5 ? ns breq setup time t brqs 30 ? ns figure 20.11 back delay time t bacd ? 15 ns bus floating time t bzd ? 40 ns breqo delay time t brqod ? 25 ns figure 20.12
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 847 of 1108 rej09b0089-0700 (4) timing of on-chip supporting modules table 20.16 timing of on-chip supporting modules condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) item symbol min max unit test conditions i/o ports output data delay time t pwd ? 40 ns figure 20.13 input data setup time t prs 25 ? ns input data hold time t prh 25 ? ns tpu timer output delay time t tocd ? 40 ns figure 20.14 timer input setup time t tics 25 ? ns timer clock input setup time t tcks 25 ? ns figure 20.15 single-edge specification t tckwh 1.5 ? t cyc timer clock pulse width both-edge specification t tckwl 2.5 ? t cyc 8-bit timer timer output delay time t tmod ? 40 ns figure 20.16 timer reset input setup time t tmrs 25 ? ns figure 20.18 timer clock input setup time t tmcs 25 ? ns figure 20.17 single-edge specification t tmcwh 1.5 ? t cyc timer clock pulse width both-edge specification t tmcwl 2.5 ? t cyc sci asynchronous t scyc 4 ? t cyc figure 20.20 input clock cycle synchronous 6 ? t cyc input clock pulse width t sckw 0.4 0.6 t scyc input clock rise time t sckr ? 1.5 t cyc input clock fall time t sckf ? 1.5 t cyc transmit data delay time t txd ? 40 ns figure 20.21 receive data setup time (synchronous) t rxs 40 ? ns receive data hold time (synchronous) t rxh 40 ? ns a/d converter trigger input setup time t trgs 30 ? ns figure 20.22
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 848 of 1108 rej09b0089-0700 20.2.4 a/d conversion characteristics table 20.17 a/d conversion characteristics condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) item min typ max unit resolution 10 10 10 bits conversion time 10.6 ? ? s analog input capacitance ? ? 20 pf permissible signal source impedance ? ? 5 k nonlinearity error ? ? 5.5 lsb offset error ? ? 5.5 lsb full-scale error ? ? 5.5 lsb quantization error ? ? 0.5 lsb absolute accuracy ? ? 6.0 lsb 20.2.5 d/a conversion characteristics table 20.18 d/a conversion characteristics condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) item min typ max unit test conditions resolution 8 8 8 bits conversion time ? ? 10 s 20-pf capacitive load absolute accuracy ? 2.0 3.0 lsb 2-m resistive load ? ? 2.0 lsb 4-m resistive load
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 849 of 1108 rej09b0089-0700 20.2.6 flash memory characteristics table 20.19 flash memory characteristics condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, t a = 0c to +75c (program/erase operating temperature range: regular specifications), t a = 0c to +85c (program/erase operating temperature range: wide-range specifications) item symbol min typ max unit test conditions programming time * 1 * 2 * 4 t p ? 10 200 ms/ 128 bytes erase time * 1 * 3 * 6 t e ? 50 1000 ms/block reprogramming count n wec 100 * 7 10000 * 8 ? times data retention time * 9 t drp 10 ? ? years programming wait time after swe bit setting * 1 x 1 ? ? s wait time after psu bit setting * 1 y 50 ? ? s wait time after p bit setting * 1 * 4 z (z1) ? ? 30 s 1 n 6 (z2) ? ? 200 s 7 n 1000 (z3) ? ? 10 s additional- program- ming time wait wait time after p bit clearing * 1 5 ? ? s wait time after psu bit clearing * 1 5 ? ? s wait time after pv bit setting * 1 4 ? ? s wait time after h'ff dummy write * 1 2 ? ? s wait time after pv bit clearing * 1 2 ? ? s wait time after swe bit clearing * 1 100 ? ? s maximum number of writes * 1 * 4 n ? ? 1000 * 5 times erasing wait time after swe bit setting * 1 x 1 ? ? s wait time after esu bit setting * 1 y 100 ? ? s wait time after e bit setting * 1 * 6 z ? ? 10 s wait time after e bit clearing * 1 10 ? ? s wait time after esu bit clearing * 1 10 ? ? s wait time after ev bit setting * 1 20 ? ? s wait time after h'ff dummy write * 1 2 ? ? s wait time after ev bit clearing * 1 4 ? ? s wait time after swe bit clearing * 1 100 ? ? s maximum number of erases * 1 * 6 n ? ? 100 times
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 850 of 1108 rej09b0089-0700 notes: 1. follow the program/erase algorithms when making the time settings. 2. programming time per 128 bytes. (in the h8s/2318, h8s/2317, h8s/2315, and h8s/2314, indicates the total time during which the p bit in flash memory control register 1 (flmcr1) is set. in the h8s/2319, indicates the total time during which the p1 bit and p2 bit in the flash memory control registers (flmcr1, flmcr2) are set. does not include the program-verify time.) 3. time to erase one block. (in the h8s/2318, h8s/2317, h8s/2315, and h8s/2314, indicates the total time during which during which the e1 bit in flmcr1 and the e2 bit in flmcr2 are set. does not include the erase-verify time.) 4. maximum programming time wait time after p bit setting (z) n t p (max) = i=1 5. the maximum number of writes (n) should be set as shown below according to the actual set value of z so as not to exceed the maximum programming time (t p (max)). the wait time after p bit setting (z) should be changed as follows according to the number of writes (n). number of writes (n) 1 n 6 z = 30 s 7 n 1000 z = 200 s [in additional programming] number of writes (n) 1 n 6 z = 10 s 6. for the maximum erase time (t e (max)), the following relationship applies between the wait time after e bit setting (z) and the maximum number of erases (n): t e (max) = wait time after e bit setting (z) maximum number of erases (n) 7. minimum number of times for which all characteristics are guaranteed after rewriting (guarantee range is 1 to minimum value). 8. reference value for 25c (as a guideline, rewriting should normally function up to this value). 9. data retention characteristic when rewriting is performed within the specification range, including the minimum value.
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 851 of 1108 rej09b0089-0700 20.3 electrical characteristics of f- ztat version (h8s/2319c f-ztat) 20.3.1 absolute maximum ratings table 20.20 absolute maximum ratings condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) item symbol value unit power supply voltage v cc * 1 ?0.3 to +4.3 v input voltage (except port 4) v in ?0.3 to v cc +0.3 v input voltage (port 4) v in ?0.3 to av cc +0.3 v reference power supply voltage v ref ?0.3 to av cc +0.3 v analog power supply voltage av cc ?0.3 to +4.3 v analog input voltage v an ?0.3 to av cc +0.3 v operating temperature t opr regular specifications: ?20 to +75 * 2 c wide-range specifications: ?40 to +85 * 2 c storage temperature t stg ?55 to +125 c caution: permanent damage to the chip may result if absolute maximum ratings are exceeded. notes: 1. do not apply the power supply voltage to the v cl pin. doing so could permanently damage the lsi. an external capacitor should be connected between this pin and gnd. 2. the operating temperature ranges for flash memory programming/erasing are t a = 0c to +75c (regular specifications), and t a = 0c to +85c (wide-range specifications).
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 852 of 1108 rej09b0089-0700 20.3.2 dc characteristics table 20.21 dc characteristics condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v * 1 , t a = ?20c to +75c (regular specifications), t a = ?40c to +85c (wide-range specifications) item symbol min typ max unit test conditions schmitt trigger input voltage ports 1, 2, irq0 to irq7 vt ? v cc 0.2 ? ? v vt + ? ? v cc 0.7 v vt + ? vt ? v cc 0.07 ? ? v input high voltage res , stby , nmi, md2 to md0 v ih v cc 0.9 ? v cc + 0.3 v extal v cc 0.7 ? v cc + 0.3 v ports 3, a to g 2.2 ? v cc + 0.3 v port 4 2.2 ? av cc + 0.3 v input low voltage res , stby , md2 to md0 v il ?0.3 ? v cc 0.1 v nmi, extal, ports 3, 4, a to g ?0.3 ? v cc 0.2 v all output pins v oh v cc ? 0.5 ? ? v i oh = ?200 a output high voltage v cc ? 1.0 ? ? v i oh = ?1 ma output low voltage all output pins v ol ? ? 0.4 v i ol = 1.6 ma res | i in | ? ? 10.0 a v in = 0.5 v to v cc ? 0.5 v input leakage current stby , nmi, md2 to md0 ? ? 1.0 a port 4 ? ? 1.0 a v in = 0.5 v to av cc ? 0.5 v three-state leakage current (off state) ports 1 to 3, a to g | i tsi | ? ? 1.0 a v in = 0.5 v to v cc ? 0.5 v
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 853 of 1108 rej09b0089-0700 item symbol min typ max unit test conditions input pull-up mos current ports a to e ?i p 10 ? 300 a v cc = 3.0 v to 3.6 v, v in = 0 v res ? ? 30 pf v in = 0 v nmi ? ? 30 pf f = 1 mhz input capacitance all input pins except res and nmi c in ? ? 15 pf t a = 25c normal operation ? 25 (3.3 v) 50 ma sleep mode 17 (3.3 v) 40 ma f = 25 mhz ? 20 90 a t a 50c current dissipation * 2 standby mode * 3 i cc * 4 ? ? 120 a 50c < t a during a/d and d/a conversion ? 1.0 (3.0 v) 2.0 ma analog power supply voltage idle ai cc ? 1.0 5.0 a during a/d and d/a conversion ? 1.4 (3.0 v) 3.0 ma reference power supply voltage idle ai cc ? 0.2 5.0 a ram standby voltage v ram 2.5 ? ? v vcc start voltage * 5 vcc start ? ? 0.4 v vcc rising edge * 5 svcc ? ? 10 ms/v notes: 1. if the a/d and d/a converters are not used, do not leave the av cc , v ref , and av ss pins open . connect the av cc and v ref pins to v cc , and the av ss pin to v ss . 2. current dissipation values are for v ih min = v cc ? 0.2 v and v il max = 0.2 v with all output pins unloaded and all mos input pull-ups in the off state. 3. the values are for v ram v cc < 3.0 v, v ih min = v cc 0.9, and v il max = 0.3 v. 4. i cc depends on v cc and f as follows: i cc max = 0.5 (ma) + 0.55 (ma/(mhz v)) v cc f (normal operation) i cc max = 0.4 (ma) + 0.44 (ma/(mhz v)) v cc f (sleep mode) 5. applies on condition that the res pin is low level at power on.
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 854 of 1108 rej09b0089-0700 table 20.22 permissible output currents condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, t a = ?20 to +75c (regular specifications), t a = ?40 to +85c (wide-range specifications) item symbol min typ max unit permissible output low current (per pin) all output pins i ol ? ? 2.0 ma permissible output low current (total) total of all output pins i ol ? ? 80 ma permissible output high current (per pin) all output pins ?i oh ? ? 2.0 ma permissible output high current (total) total of all output pins ?i oh ? ? 40 ma note: to protect chip reliability, do not exceed the output current values in table 20.22.
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 855 of 1108 rej09b0089-0700 20.3.3 ac characteristics (1) clock timing table 20.23 clock timing condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) item symbol min max unit test conditions clock cycle time t cyc 40 500 ns figure 20.2 clock pulse high width t ch 15 ? ns clock pulse low width t cl 15 ? ns clock rise time t cr ? 5 ns clock fall time t cf ? 5 ns reset oscillation stabilization time (crystal) t osc1 10 ? ms figure 20.3 software standby oscillation stabilization time (crystal) t osc2 10 ? ms external clock output stabilization delay time t dext 500 ? s figure 20.3
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 856 of 1108 rej09b0089-0700 (2) control signal timing table 20.24 control signal timing condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) item symbol min max unit test conditions res setup time t ress 200 ? ns figure 20.4 res pulse width t resw 20 ? t cyc nmi setup time t nmis 150 ? ns figure 20.5 nmi hold time t nmih 10 ? ns nmi pulse width (in recovery from software standby mode) t nmiw 200 ? ns irq setup time t irqs 150 ? ns irq hold time t irqh 10 ? ns irq pulse width (in recovery from software standby mode) t irqw 200 ? ns
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 857 of 1108 rej09b0089-0700 (3) bus timing table 20.25 bus timing condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) item symbol min max unit test conditions address delay time t ad ? 20 ns figures 20.6 to 20.10 address setup time t as 0.5 t cyc ? 15 ? ns address hold time t ah 0.5 t cyc ? 8 ? ns cs delay time 1 t csd1 ? 15 ns as delay time t asd ? 15 ns rd delay time 1 t rsd1 ? 15 ns rd delay time 2 t rsd2 ? 15 ns read data setup time t rds 15 ? ns read data hold time t rdh 0 ? ns read data access time 1 t acc1 ? 1.0 t cyc ? 20 ns read data access time 2 t acc2 ? 1.5 t cyc ? 20 ns read data access time 3 t acc3 ? 2.0 t cyc ? 20 ns read data access time 4 t acc4 ? 2.5 t cyc ? 20 ns read data access time 5 t acc5 ? 3.0 t cyc ? 20 ns wr delay time 1 t wrd1 ? 15 ns wr delay time 2 t wrd2 ? 15 ns wr pulse width 1 t wsw1 1.0 t cyc ? 15 ? ns wr pulse width 2 t wsw2 1.5 t cyc ? 15 ? ns write data delay time t wdd ? 20 ns write data setup time t wds 0.5 t cyc ? 15 ? ns write data hold time t wdh 0.5 t cyc ? 8 ? ns wait setup time t wts 25 ? ns figure 20.8 wait hold time t wth 5 ? ns breq setup time t brqs 30 ? ns figure 20.11 back delay time t bacd ? 15 ns bus floating time t bzd ? 40 ns breqo delay time t brqod ? 25 ns figure 20.12
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 858 of 1108 rej09b0089-0700 (4) timing of on-chip supporting modules table 20.26 timing of on-chip supporting modules condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) item symbol min max unit test conditions output data delay time t pwd ? 40 ns input data setup time t prs 25 ? ns i/o ports input data hold time t prh 25 ? ns figure 20.13 timer output delay time t tocd ? 40 ns timer input setup time t tics 25 ? ns figure 20.14 timer clock input setup time t tcks 25 ? ns single-edge specification t tckwh 1.5 ? t cyc tpu timer clock pulse width both-edge specification t tckwl 2.5 ? t cyc figure 20.15 timer output delay time t tmod ? 40 ns figure 20.16 timer reset input setup time t tmrs 25 ? ns figure 20.18 timer clock input setup time t tmcs 25 ? ns single-edge specification t tmcwh 1.5 ? t cyc 8-bit timer timer clock pulse width both-edge specification t tmcwl 2.5 ? t cyc figure 20.17 asynchronous 4 ? t cyc input clock cycle synchronous t scyc 6 ? t cyc input clock pulse width t sckw 0.4 0.6 t scyc input clock rise time t sckr ? 1.5 t cyc input clock fall time t sckf ? 1.5 t cyc figure 20.20 transmit data delay time t txd ? 40 ns receive data setup time (synchronous) t rxs 40 ? ns sci receive data hold time (synchronous) t rxh 40 ? ns figure 20.21 a/d converter trigger input setup time t trgs 30 ? ns figure 20.22
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 859 of 1108 rej09b0089-0700 20.3.4 a/d conversion characteristics table 20.27 a/d conversion characteristics condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) item min typ max unit resolution 10 10 10 bits conversion time 10.6 ? ? s analog input capacitance ? ? 20 pf permissible signal source impedance ? ? 5 k nonlinearity error ? ? 5.5 lsb offset error ? ? 5.5 lsb full-scale error ? ? 5.5 lsb quantization error ? ? 0.5 lsb absolute accuracy ? ? 6.0 lsb 20.3.5 d/a conversion characteristics table 20.28 d/a conversion characteristics condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, = 2 mhz to 25 mhz, t a = ?20c to 75c (regular specifications), t a = ?40c to 85c (wide-range specifications) item min typ max unit test conditions resolution 8 8 8 bits conversion time ? ? 10 s 20-pf capacitive load absolute accuracy ? 2.0 3.0 lsb 2-m resistive load ? ? 2.0 lsb 4-m resistive load
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 860 of 1108 rej09b0089-0700 20.3.6 flash memory characteristics table 20.29 flash memory characteristics condition b: v cc = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = 3.0 v to av cc , v ss = av ss = 0 v, t a = 0c to +75c (program/erase operating temperature range: regular specifications), t a = 0c to +85c (program/erase operating temperature range: wide-range specifications) item symbol min typ max unit test conditions programming time * 1 * 2 * 4 t p ? 3 30 ms/128 bytes erase time * 1 * 3 * 4 t e ? 80 800 ms/4-kbyte block ? 500 5000 ms/32-kbyte block ? 1000 10000 ms/64-kbyte block programming time (total) * 1 * 2 * 4 t p ? 10 30 s/512 kbytes t a = 25c when all cleared to 0 erase time (total) * 1 * 2 * 4 t e ? 10 30 s/512 kbytes programming and erase time (total) * 1 * 2 * 4 t pe ? 20 60 s/512 kbytes t a = 25 c number of overwrites nwec 100 * 3 10000 * 5 ? times data retention time * 4 t drp 10 ? ? years notes: 1. the exact programming and erase times depend on the characteristics of the data. 2. programming and erase times do not include data transfer time. 3. this is the minimum number of rewrites after which all characteristics are guaranteed. (the guaranteed range is 1 to minimum.) 4. this characteristic applies when the number of rewrites is within the specification range, including minimum values. 5. reference value for 25 c (as a guideline, rewriting should normally function up to this value).
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 861 of 1108 rej09b0089-0700 20.3.7 usage note (internal voltage step down for the h8s/2319c f-ztat) the h8s/2319c f-ztat has an on-chip voltage step down circuit that automatically lowers the power supply voltage, inside the microcomputer, to an adequate level. a capacitor (0.1 f) should be connected between the internal voltage step down circuit pin (v cl pin) and the v ss pin to stabilize the internal voltage. figure 20.23 shows ho w to connect the capacito r. do not connect the v cc power supply to the v cl pin. doing so could permanently damage the lsi. (connect the v cc power-supply to the v cc pin, in the usual way.) v cl v ss external capacitor to stabilize the power supply do not connect the v cc power-supply to the v cl pin. doing so could permanently damage the lsi. (connect the v cc power-supply to the v cc pin, in the usual way.) use a multilayer ceramic capacitor (0.1 f), and place it near the pins. 0.1 f figure 20.23 v cl capacitor connection method 20.4 usage note although both the f-ztat and mask rom versions fully meet the electrical specifications listed in this manual, there may be differences in th e actual values of the electrical characteristics, operating margins, noise margins, and so forth, due to differences in the fabrication process, the on-chip rom, and the layout patterns. if the f-ztat version is used to carry out system evaluation and testing, therefore, when switching to the mask rom version the same evaluation and testing procedures should also be conducted on this version.
section 20 electrical characteristics rev.7.00 feb. 14, 2007 page 862 of 1108 rej09b0089-0700
appendix a instruction set rev.7.00 feb. 14, 2007 page 863 of 1108 rej09b0089-0700 appendix a instruction set a.1 instruction list operand notation rd general register (destination) * 1 rs general register (source) * 1 rn general register * 1 ern general register (32-bit register) mac multiply-and-accumulate register (32-bit register) * 2 (ead) destination operand (eas) source operand exr extended control register ccr condition-code register n n (negative) flag in ccr z z (zero) flag in ccr v v (overflow) flag in ccr c c (carry) flag in ccr pc program counter sp stack pointer #imm immediate data disp displacement + add ? subtract multiply divide logical and logical or logical exclusive or transfer from the operand on the left to the operand on the right, or transition from the state on the left to the state on the right ? logical not (logical complement) ( ) < > contents of operand :8/:16/:24/:32 8-, 16-, 24-, or 32-bit length notes: 1. general registers include 8-bit registers (r0h to r7h, r0l to r7l), 16-bit registers (r0 to r7, e0 to e7), and 32-bit registers (er0 to er7). 2. the mac register cannot be used in the h8s/2319 group.
appendix a instruction set rev.7.00 feb. 14, 2007 page 864 of 1108 rej09b0089-0700 condition code notation symbol changes according to the result of the instruction * undetermined (no guaranteed value) 0 always cleared to 0 1 always set to 1 ? not affected by execution of the instruction
appendix a instruction set rev.7.00 feb. 14, 2007 page 865 of 1108 rej09b0089-0700 table a.1 instruction set (1) data transfer instructions addressing mode/ instruction length (bytes) operand size #xx rn @ern @(d,ern) @ - ern/@ern+ @aa @(d,pc) @@aa mnemonic mov mov.b #xx:8,rd b 2 mov.b rs,rd b 2 mov.b @ers,rd b 2 mov.b @(d:16,ers),rd b 4 mov.b @(d:32,ers),rd b 8 mov.b @ers+,rd b 2 mov.b @aa:8,rd b 2 mov.b @aa:16,rd b 4 mov.b @aa:32,rd b 6 mov.b rs,@erd b 2 mov.b rs,@(d:16,erd) b 4 mov.b rs,@(d:32,erd) b 8 mov.b rs,@-erd b 2 mov.b rs,@aa:8 b 2 mov.b rs,@aa:16 b 4 mov.b rs,@aa:32 b 6 mov.w #xx:16,rd w 4 mov.w rs,rd w 2 mov.w @ers,rd w 2 #xx:8 rd8 ? ? 0 ? 1 rs8 rd8 ? ? 0 ? 1 @ers rd8 ? ? 0 ? 2 @(d:16,ers) rd8 ? ? 0 ? 3 @(d:32,ers) rd8 ? ? 0 ? 5 @ers rd8,ers32+1 ers32 ? ? 0 ? 3 @aa:8 rd8 ? ? 0 ? 2 @aa:16 rd8 ? ? 0 ? 3 @aa:32 rd8 ? ? 0 ? 4 rs8 @erd ? ? 0 ? 2 rs8 @(d:16,erd) ? ? 0 ? 3 rs8 @(d:32,erd) ? ? 0 ? 5 erd32-1 erd32,rs8 @erd ? ? 0 ? 3 rs8 @aa:8 ? ? 0 ? 2 rs8 @aa:16 ? ? 0 ? 3 rs8 @aa:32 ? ? 0 ? 4 #xx:16 rd16 ? ? 0 ? 2 rs16 rd16 ? ? 0 ? 1 @ers rd16 ? ? 0 ? 2 operation condition code ihnzvc advanced no. of states * 1 ??????????????????? ???????????????????
appendix a instruction set rev.7.00 feb. 14, 2007 page 866 of 1108 rej09b0089-0700 addressing mode/ instruction length (bytes) operand size #xx rn @ern @(d,ern) @ - ern/@ern+ @aa @(d,pc) @@aa mnemonic mov mov.w @(d:16,ers),rd w 4 mov.w @(d:32,ers),rd w 8 mov.w @ers+,rd w 2 mov.w @aa:16,rd w 4 mov.w @aa:32,rd w 6 mov.w rs,@erd w 2 mov.w rs,@(d:16,erd) w 4 mov.w rs,@(d:32,erd) w 8 mov.w rs,@-erd w 2 mov.w rs,@aa:16 w 4 mov.w rs,@aa:32 w 6 mov.l #xx:32,erd l 6 mov.l ers,erd l 2 mov.l @ers,erd l 4 mov.l @(d:16,ers),erd l 6 mov.l @(d:32,ers),erd l 10 mov.l @ers+,erd l 4 mov.l @aa:16,erd l 6 mov.l @aa:32,erd l 8 @(d:16,ers) rd16 ? ? 0 ? 3 @(d:32,ers) rd16 ? ? 0 ? 5 @ers rd16,ers32+2 ers32 ? ? 0 ? 3 @aa:16 rd16 ? ? 0 ? 3 @aa:32 rd16 ? ? 0 ? 4 rs16 @erd ? ? 0 ? 2 rs16 @(d:16,erd) ? ? 0 ? 3 rs16 @(d:32,erd) ? ? 0 ? 5 erd32-2 erd32,rs16 @erd ? ? 0 ? 3 rs16 @aa:16 ? ? 0 ? 3 rs16 @aa:32 ? ? 0 ? 4 #xx:32 erd32 ? ? 0 ? 3 ers32 erd32 ? ? 0 ? 1 @ers erd32 ? ? 0 ? 4 @(d:16,ers) erd32 ? ? 0 ? 5 @(d:32,ers) erd32 ? ? 0 ? 7 @ers erd32,ers32+4 @ers32 ? ? 0 ? 5 @aa:16 erd32 ? ? 0 ? 5 @aa:32 erd32 ? ? 0 ? 6 operation condition code ihnzvc advanced no. of states * 1 ??????????????????? ???????????????????
appendix a instruction set rev.7.00 feb. 14, 2007 page 867 of 1108 rej09b0089-0700 addressing mode/ instruction length (bytes) operand size #xx rn @ern @(d,ern) @-ern/@ern+ @aa @(d,pc) @@aa mnemonic mov pop push ldm stm movfpe movtpe mov.l ers,@erd l 4 mov.l ers,@(d:16,erd) l 6 mov.l ers,@(d:32,erd) l 10 mov.l ers,@-erd l 4 mov.l ers,@aa:16 l 6 mov.l ers,@aa:32 l 8 pop.w rn w 2 pop.l ern l 4 push.w rn w 2 push.l ern l 4 ldm @sp+,(erm-ern) l 4 stm (erm-ern),@-sp l 4 movfpe @aa:16,rd movtpe rs,@aa:16 ers32 @erd ? ? 0 ? 4 ers32 @(d:16,erd) ? ? 0 ? 5 ers32 @(d:32,erd) ? ? 0 ? 7 erd32-4 erd32,ers32 @ erd ? ? 0 ? 5 ers32 @aa:16 ? ? 0 ? 5 ers32 @aa:32 ? ? 0 ? 6 @sp rn16,sp+2 sp ? ? 0 ? 3 @sp ern32,sp+4 sp ? ? 0 ? 5 sp-2 sp,rn16 @sp ? ? 0 ? 3 sp-4 sp,ern32 @sp ? ? 0 ? 5 (@sp ern32,sp+4 sp) ? ? ? ? ? ? 7/9/11 [1] repeated for each register restored (sp-4 sp,ern32 @sp) ? ? ? ? ? ? 7/9/11 [1] repeated for each register saved [2] [2] operation condition code ihnzvc advanced no. of states * 1 ?????????? ?????????? cannot be used in the chip cannot be used in the chip
appendix a instruction set rev.7.00 feb. 14, 2007 page 868 of 1108 rej09b0089-0700 (2) arithmetic instructions addressing mode/ instruction length (bytes) operand size #xx rn @ern @(d,ern) @-ern/@ern+ @aa @(d,pc) @@aa mnemonic add addx adds inc daa sub add.b #xx:8,rd b 2 add.b rs,rd b 2 add.w #xx:16,rd w 4 add.w rs,rd w 2 add.l #xx:32,erd l 6 add.l ers,erd l 2 addx #xx:8,rd b 2 addx rs,rd b 2 adds #1,erd l 2 adds #2,erd l 2 adds #4,erd l 2 inc.b rd b 2 inc.w #1,rd w 2 inc.w #2,rd w 2 inc.l #1,erd l 2 inc.l #2,erd l 2 daa rd b 2 sub.b rs,rd b 2 sub.w #xx:16,rd w 4 rd8+#xx:8 rd8 ? 1 rd8+rs8 rd8 ? 1 rd16+#xx:16 rd16 ? [3] 2 rd16+rs16 rd16 ? [3] 1 erd32+#xx:32 erd32 ? [4] 3 erd32+ers32 erd32 ? [4] 1 rd8+#xx:8+c rd8 ? [5] 1 rd8+rs8+c rd8 ? [5] 1 erd32+1 erd32 ? ? ? ? ? ? 1 erd32+2 erd32 ? ? ? ? ? ? 1 erd32+4 erd32 ? ? ? ? ? ? 1 rd8+1 rd8 ? ? ? 1 rd16+1 rd16 ? ? ? 1 rd16+2 rd16 ? ? ? 1 erd32+1 erd32 ? ? ? 1 erd32+2 erd32 ? ? ? 1 rd8 decimal adjust rd8 ? * * 1 rd8-rs8 rd8 ? 1 rd16-#xx:16 rd16 ? [3] 2 operation condition code ihnzvc advanced no. of states * 1 ??? ? ???????? ?? ????? ???????? ???????? ???????? ?????? ???????? ?? ??
appendix a instruction set rev.7.00 feb. 14, 2007 page 869 of 1108 rej09b0089-0700 addressing mode/ instruction length (bytes) operand size #xx rn @ern @(d,ern) @-ern/@ern+ @aa @(d,pc) @@aa mnemonic sub subx subs dec das mulxu mulxs sub.w rs,rd w 2 sub.l #xx:32,erd l 6 sub.l ers,erd l 2 subx #xx:8,rd b 2 subx rs,rd b 2 subs #1,erd l 2 subs #2,erd l 2 subs #4,erd l 2 dec.b rd b 2 dec.w #1,rd w 2 dec.w #2,rd w 2 dec.l #1,erd l 2 dec.l #2,erd l 2 das rd b 2 mulxu.b rs,rd b 2 mulxu.w rs,erd w 2 mulxs.b rs,rd b 4 mulxs.w rs,erd w 4 rd16-rs16 rd16 ? [3] 1 erd32-#xx:32 erd32 ? [4] 3 erd32-ers32 erd32 ? [4] 1 rd8-#xx:8-c rd8 ? [5] 1 rd8-rs8-c rd8 ? [5] 1 erd32-1 erd32 ? ? ? ? ? ? 1 erd32-2 erd32 ? ? ? ? ? ? 1 erd32-4 erd32 ? ? ? ? ? ? 1 rd8-1 rd8 ? ? ? 1 rd16-1 rd16 ? ? ? 1 rd16-2 rd16 ? ? ? 1 erd32-1 erd32 ? ? ? 1 erd32-2 erd32 ? ? ? 1 rd8 decimal adjust rd8 ? * * ? 1 rd8 rs8 rd16 (unsigned multiplication) ? ? ? ? ? ? 12 rd16rs16 erd32 ? ? ? ? ? ? 20 (unsigned multiplication) rd8 rs8 rd16 (signed multiplication) ? ? ? ? 13 rd16rs16 erd32 ? ? ? ? 21 (signed multiplication) operation condition code ihnzvc advanced no. of states * 1 ?? ?? ?????? ?????? ????? ??? ????? ????? ????? ??
appendix a instruction set rev.7.00 feb. 14, 2007 page 870 of 1108 rej09b0089-0700 addressing mode/ instruction length (bytes) operand size #xx rn @ern @(d,ern) @-ern/@ern+ @aa @(d,pc) @@aa mnemonic divxu divxs cmp neg extu divxu.b rs,rd b 2 divxu.w rs,erd w 2 divxs.b rs,rd b 4 divxs.w rs,erd w 4 cmp.b #xx:8,rd b 2 cmp.b rs,rd b 2 cmp.w #xx:16,rd w 4 cmp.w rs,rd w 2 cmp.l #xx:32,erd l 6 cmp.l ers,erd l 2 neg.b rd b 2 neg.w rd w 2 neg.l erd l 2 extu.w rd w 2 extu.l erd l 2 rd16 rs8 rd16 (rdh: remainder, ? ? [6] [7] ? ? 12 rdl: quotient) (unsigned division) erd32 rs16 erd32 (ed: remainder, ? ? [6] [7] ? ? 20 rd: quotient) (unsigned division) rd16 rs8 rd16 (rdh: remainder, ? ? [8] [7] ? ? 13 rdl: quotient) (signed division) erd32 rs16 erd32 (ed: remainder, ? ? [8] [7] ? ? 21 rd: quotient) (signed division) rd8-#xx:8 ? 1 rd8-rs8 ? 1 rd16-#xx:16 ? [3] 2 rd16-rs16 ? [3] 1 erd32-#xx:32 ? [4] 3 erd32-ers32 ? [4] 1 0-rd8 rd8 ? 1 0-rd16 rd16 ? 1 0-erd32 erd32 ? 1 0 ( of rd16) ? ? 0 0 ? 1 0 ( of erd32) ? ? 0 0 ? 1 operation condition code ihnzvc advanced no. of states * 1 ??? ?? ??????????? ????????? ????????? ?????????
appendix a instruction set rev.7.00 feb. 14, 2007 page 871 of 1108 rej09b0089-0700 addressing mode/ instruction length (bytes) operand size #xx rn @ern @(d,ern) @-ern/@ern+ @aa @(d,pc) @@aa mnemonic exts tas mac clrmac ldmac stmac exts.w rd w 2 exts.l erd l 2 tas @erd * 3 b 4 mac @ern+, @erm+ clrmac ldmac ers,mach ldmac ers,macl stmac mach,erd stmac macl,erd ( of rd16) ? ? 0 ? 1 ( of rd16) ( of erd32) ? ? 0 ? 1 ( of erd32) @erd-0 ccr set, (1) ? ? 0 ? 4 ( of @erd) [2] operation condition code ihnzvc advanced no. of states * 1 ? ? ? ? ? ? cannot be used in the chip
appendix a instruction set rev.7.00 feb. 14, 2007 page 872 of 1108 rej09b0089-0700 (3) logical instructions addressing mode/ instruction length (bytes) operand size #xx rn @ern @(d,ern) @-ern/@ern+ @aa @(d,pc) @@aa mnemonic and or xor not and.b #xx:8,rd b 2 and.b rs,rd b 2 and.w #xx:16,rd w 4 and.w rs,rd w 2 and.l #xx:32,erd l 6 and.l ers,erd l 4 or.b #xx:8,rd b 2 or.b rs,rd b 2 or.w #xx:16,rd w 4 or.w rs,rd w 2 or.l #xx:32,erd l 6 or.l ers,erd l 4 xor.b #xx:8,rd b 2 xor.b rs,rd b 2 xor.w #xx:16,rd w 4 xor.w rs,rd w 2 xor.l #xx:32,erd l 6 xor.l ers,erd l 4 not.b rd b 2 not.w rd w 2 not.l erd l 2 rd8 #xx:8 rd8 ? ? 0 ? 1 rd8 rs8 rd8 ? ? 0 ? 1 rd16 #xx:16 rd16 ? ? 0 ? 2 rd16 rs16 rd16 ? ? 0 ? 1 erd32 #xx:32 erd32 ? ? 0 ? 3 erd32 ers32 erd32 ? ? 0 ? 2 rd8 #xx:8 rd8 ? ? 0 ? 1 rd8 rs8 rd8 ? ? 0 ? 1 rd16 #xx:16 rd16 ? ? 0 ? 2 rd16 rs16 rd16 ? ? 0 ? 1 erd32 #xx:32 erd32 ? ? 0 ? 3 erd32 ers32 erd32 ? ? 0 ? 2 rd8 #xx:8 rd8 ? ? 0 ? 1 rd8 rs8 rd8 ? ? 0 ? 1 rd16 #xx:16 rd16 ? ? 0 ? 2 rd16 rs16 rd16 ? ? 0 ? 1 erd32 #xx:32 erd32 ? ? 0 ? 3 erd32 ers32 erd32 ? ? 0 ? 2 ? rd8 rd8 ? ? 0 ? 1 ? rd16 rd16 ? ? 0 ? 1 ? erd32 erd32 ? ? 0 ? 1 operation condition code ihnzvc advanced no. of states * 1 ????????????????????? ?????????????????????
appendix a instruction set rev.7.00 feb. 14, 2007 page 873 of 1108 rej09b0089-0700 (4) shift instructions addressing mode/ instruction length (bytes) operand size #xx rn @ern @(d,ern) @-ern/@ern+ @aa @(d,pc) @@aa mnemonic shal shar shll shal.b rd b 2 shal.b #2,rd b 2 shal.w rd w 2 shal.w #2,rd w 2 shal.l erd l 2 shal.l #2,erd l 2 shar.b rd b 2 shar.b #2,rd b 2 shar.w rd w 2 shar.w #2,rd w 2 shar.l erd l 2 shar.l #2,erd l 2 shll.b rd b 2 shll.b #2,rd b 2 shll.w rd w 2 shll.w #2,rd w 2 shll.l erd l 2 shll.l #2,erd l 2 ? ? 1 ? ? 1 ? ? 1 ? ? 1 ? ? 1 ? ? 1 ? ? 0 1 ? ? 0 1 ? ? 0 1 ? ? 0 1 ? ? 0 1 ? ? 0 1 ? ? 0 1 ? ? 0 1 ? ? 0 1 ? ? 0 1 ? ? 0 1 ? ? 0 1 operation condition code ihnzvc advanced no. of states * 1 ?????????????????? ?????????????????? ?????? ?????????????????? c msb lsb msb lsb 0 c msb lsb c 0
appendix a instruction set rev.7.00 feb. 14, 2007 page 874 of 1108 rej09b0089-0700 addressing mode/ instruction length (bytes) operand size #xx rn @ern @(d,ern) @-ern/@ern+ @aa @(d,pc) @@aa mnemonic shlr rotxl rotxr shlr.b rd b 2 shlr.b #2,rd b 2 shlr.w rd w 2 shlr.w #2,rd w 2 shlr.l erd l 2 shlr.l #2,erd l 2 rotxl.b rd b 2 rotxl.b #2,rd b 2 rotxl.w rd w 2 rotxl.w #2,rd w 2 rotxl.l erd l 2 rotxl.l #2,erd l 2 rotxr.b rd b 2 rotxr.b #2,rd b 2 rotxr.w rd w 2 rotxr.w #2,rd w 2 rotxr.l erd l 2 rotxr.l #2,erd l 2 ? ? ? 0 0 1 ? ? ? 0 0 1 ? ? ? 0 0 1 ? ? ? 0 0 1 ? ? ? 0 0 1 ? ? ? 0 0 1 ? ? ? 0 1 ? ? ? 0 1 ? ? ? 0 1 ? ? ? 0 1 ? ? ? 0 1 ? ? ? 0 1 ? ? ? 0 1 ? ? ? 0 1 ? ? ? 0 1 ? ? ? 0 1 ? ? ? 0 1 ? ? 0 1 operation condition code ihnzvc advanced no. of states * 1 ?????????????????? ?????????????????? ???????????? c msb lsb 0 c msb lsb c msb lsb
appendix a instruction set rev.7.00 feb. 14, 2007 page 875 of 1108 rej09b0089-0700 ? ? 0 1 ? ? 0 1 ? ? 0 1 ? ? 0 1 ? ? 0 1 ? ? 0 1 ? ? ? 0 1 ? ? ? 0 1 ? ? ? 0 1 ? ? 0 1 ? ? ? 0 1 1 ? ? 0 1 addressing mode/ instruction length (bytes) operand size #xx rn @ern @(d,ern) @-ern/@ern+ @aa @(d,pc) @@aa mnemonic rotl rotr rotl.b rd b 2 rotl.b #2,rd b 2 rotl.w rd w 2 rotl.w #2,rd w 2 rotl.l erd l 2 rotl.l #2,erd l 2 rotr.b rd b 2 rotr.b #2,rd b 2 rotr.w rd w 2 rotr.w #2,rd w 2 rotr.l erd l 2 rotr.l #2,erd l 2 operation condition code ihnzvc advanced no. of states * 1 ???????????? ???????????? ???????????? c msb lsb c msb lsb
appendix a instruction set rev.7.00 feb. 14, 2007 page 876 of 1108 rej09b0089-0700 (5) bit-manipulation instructions addressing mode/ instruction length (bytes) operand size #xx rn @ern @(d,ern) @-ern/@ern+ @aa @(d,pc) @@aa mnemonic bset bclr bset #xx:3,rd b 2 bset #xx:3,@erd b 4 bset #xx:3,@aa:8 b 4 bset #xx:3,@aa:16 b 6 bset #xx:3,@aa:32 b 8 bset rn,rd b 2 bset rn,@erd b 4 bset rn,@aa:8 b 4 bset rn,@aa:16 b 6 bset rn,@aa:32 b 8 bclr #xx:3,rd b 2 bclr #xx:3,@erd b 4 bclr #xx:3,@aa:8 b 4 bclr #xx:3,@aa:16 b 6 bclr #xx:3,@aa:32 b 8 bclr rn,rd b 2 bclr rn,@erd b 4 bclr rn,@aa:8 b 4 bclr rn,@aa:16 b 6 (#xx:3 of rd8) 1 ? ? ? ? ? ? 1 (#xx:3 of @erd) 1 ? ? ? ? ? ? 4 (#xx:3 of @aa:8) 1 ? ? ? ? ? ? 4 (#xx:3 of @aa:16) 1 ? ? ? ? ? ? 5 (#xx:3 of @aa:32) 1 ? ? ? ? ? ? 6 (rn8 of rd8) 1 ? ? ? ? ? ? 1 (rn8 of @erd) 1 ? ? ? ? ? ? 4 (rn8 of @aa:8) 1 ? ? ? ? ? ? 4 (rn8 of @aa:16) 1 ? ? ? ? ? ? 5 (rn8 of @aa:32) 1 ? ? ? ? ? ? 6 (#xx:3 of rd8) 0 ? ? ? ? ? ? 1 (#xx:3 of @erd) 0 ? ? ? ? ? ? 4 (#xx:3 of @aa:8) 0 ? ? ? ? ? ? 4 (#xx:3 of @aa:16) 0 ? ? ? ? ? ? 5 (#xx:3 of @aa:32) 0 ? ? ? ? ? ? 6 (rn8 of rd8) 0 ? ? ? ? ? ? 1 (rn8 of @erd) 0 ? ? ? ? ? ? 4 (rn8 of @aa:8) 0 ? ? ? ? ? ? 4 (rn8 of @aa:16) 0 ? ? ? ? ? ? 5 operation condition code ihnzvc advanced no. of states * 1
appendix a instruction set rev.7.00 feb. 14, 2007 page 877 of 1108 rej09b0089-0700 addressing mode/ instruction length (bytes) operand size #xx rn @ern @(d,ern) @-ern/@ern+ @aa @(d,pc) @@aa mnemonic bclr bnot btst bclr rn,@aa:32 b 8 bnot #xx:3,rd b 2 bnot #xx:3,@erd b 4 bnot #xx:3,@aa:8 b 4 bnot #xx:3,@aa:16 b 6 bnot #xx:3,@aa:32 b 8 bnot rn,rd b 2 bnot rn,@erd b 4 bnot rn,@aa:8 b 4 bnot rn,@aa:16 b 6 bnot rn,@aa:32 b 8 btst #xx:3,rd b 2 btst #xx:3,@erd b 4 btst #xx:3,@aa:8 b 4 btst #xx:3,@aa:16 b 6 (rn8 of @aa:32) 0 ? ? ? ? ? ? 6 (#xx:3 of rd8) [ ? (#xx:3 of rd8)] ? ? ? ? ? ? 1 (#xx:3 of @erd) ? ? ? ? ? ? 4 [ ? (#xx:3 of @erd)] (#xx:3 of @aa:8) ? ? ? ? ? ? 4 [ ? (#xx:3 of @aa:8)] (#xx:3 of @aa:16) ? ? ? ? ? ? 5 [ ? (#xx:3 of @aa:16)] (#xx:3 of @aa:32) ? ? ? ? ? ? 6 [ ? (#xx:3 of @aa:32)] (rn8 of rd8) [ ? (rn8 of rd8)] ? ? ? ? ? ? 1 (rn8 of @erd) [ ? (rn8 of @erd)] ? ? ? ? ? ? 4 (rn8 of @aa:8) [ ? (rn8 of @aa:8)] ? ? ? ? ? ? 4 (rn8 of @aa:16) ? ? ? ? ? ? 5 [ ? (rn8 of @aa:16)] (rn8 of @aa:32) ? ? ? ? ? ? 6 [ ? (rn8 of @aa:32)] ? (#xx:3 of rd8) z ? ? ? ? ? 1 ? (#xx:3 of @erd) z ? ? ? ? ? 3 ? (#xx:3 of @aa:8) z ? ? ? ? ? 3 ? (#xx:3 of @aa:16) z ? ? ? ? ? 4 operation condition code ihnzvc advanced no. of states * 1 ????
appendix a instruction set rev.7.00 feb. 14, 2007 page 878 of 1108 rej09b0089-0700 addressing mode/ instruction length (bytes) operand size #xx rn @ern @(d,ern) @-ern/@ern+ @aa @(d,pc) @@aa mnemonic btst bld bild bst btst #xx:3,@aa:32 b 8 btst rn,rd b 2 btst rn,@erd b 4 btst rn,@aa:8 b 4 btst rn,@aa:16 b 6 btst rn,@aa:32 b 8 bld #xx:3,rd b 2 bld #xx:3,@erd b 4 bld #xx:3,@aa:8 b 4 bld #xx:3,@aa:16 b 6 bld #xx:3,@aa:32 b 8 bild #xx:3,rd b 2 bild #xx:3,@erd b 4 bild #xx:3,@aa:8 b 4 bild #xx:3,@aa:16 b 6 bild #xx:3,@aa:32 b 8 bst #xx:3,rd b 2 bst #xx:3,@erd b 4 bst #xx:3,@aa:8 b 4 ? (#xx:3 of @aa:32) z ? ? ? ? ? 5 ? (rn8 of rd8) z ? ? ? ? ? 1 ? (rn8 of @erd) z ? ? ? ? ? 3 ? (rn8 of @aa:8) z ? ? ? ? ? 3 ? (rn8 of @aa:16) z ? ? ? ? ? 4 ? (rn8 of @aa:32) z ? ? ? ? ? 5 (#xx:3 of rd8) c ? ? ? ? ? 1 (#xx:3 of @erd) c ? ? ? ? ? 3 (#xx:3 of @aa:8) c ? ? ? ? ? 3 (#xx:3 of @aa:16) c ? ? ? ? ? 4 (#xx:3 of @aa:32) c ? ? ? ? ? 5 ? (#xx:3 of rd8) c ? ? ? ? ? 1 ? (#xx:3 of @erd) c ? ? ? ? ? 3 ? (#xx:3 of @aa:8) c ? ? ? ? ? 3 ? (#xx:3 of @aa:16) c ? ? ? ? ? 4 ? (#xx:3 of @aa:32) c ? ? ? ? ? 5 c (#xx:3 of rd8) ? ? ? ? ? ? 1 c (#xx:3 of @erd) ? ? ? ? ? ? 4 c (#xx:3 of @aa:8) ? ? ? ? ? ? 4 operation condition code ihnzvc advanced no. of states * 1 ?????????? ??????
appendix a instruction set rev.7.00 feb. 14, 2007 page 879 of 1108 rej09b0089-0700 addressing mode/ instruction length (bytes) operand size #xx rn @ern @(d,ern) @-ern/@ern+ @aa @(d,pc) @@aa mnemonic bst bist band biand bor bst #xx:3,@aa:16 b 6 bst #xx:3,@aa:32 b 8 bist #xx:3,rd b 2 bist #xx:3,@erd b 4 bist #xx:3,@aa:8 b 4 bist #xx:3,@aa:16 b 6 bist #xx:3,@aa:32 b 8 band #xx:3,rd b 2 band #xx:3,@erd b 4 band #xx:3,@aa:8 b 4 band #xx:3,@aa:16 b 6 band #xx:3,@aa:32 b 8 biand #xx:3,rd b 2 biand #xx:3,@erd b 4 biand #xx:3,@aa:8 b 4 biand #xx:3,@aa:16 b 6 biand #xx:3,@aa:32 b 8 bor #xx:3,rd b 2 bor #xx:3,@erd b 4 c (#xx:3 of @aa:16) ? ? ? ? ? ? 5 c (#xx:3 of @aa:32) ? ? ? ? ? ? 6 ? c (#xx:3 of rd8) ? ? ? ? ? ? 1 ? c (#xx:3 of @erd) ? ? ? ? ? ? 4 ? c (#xx:3 of @aa:8) ? ? ? ? ? ? 4 ? c (#xx:3 of @aa:16) ? ? ? ? ? ? 5 ? c (#xx:3 of @aa:32) ? ? ? ? ? ? 6 c (#xx:3 of rd8) c ? ? ? ? ? 1 c (#xx:3 of @erd) c ? ? ? ? ? 3 c (#xx:3 of @aa:8) c ? ? ? ? ? 3 c (#xx:3 of @aa:16) c ? ? ? ? ? 4 c (#xx:3 of @aa:32) c ? ? ? ? ? 5 c [ ? (#xx:3 of rd8)] c ? ? ? ? ? 1 c [ ? (#xx:3 of @erd)] c ? ? ? ? ? 3 c [ ? (#xx:3 of @aa:8)] c ? ? ? ? ? 3 c [ ? (#xx:3 of @aa:16)] c ? ? ? ? ? 4 c [ ? (#xx:3 of @aa:32)] c ? ? ? ? ? 5 c (#xx:3 of rd8) c ? ? ? ? ? 1 c (#xx:3 of @erd) c ? ? ? ? ? 3 operation condition code ihnzvc advanced no. of states * 1 ????????????
appendix a instruction set rev.7.00 feb. 14, 2007 page 880 of 1108 rej09b0089-0700 addressing mode/ instruction length (bytes) operand size #xx rn @ern @(d,ern) @-ern/@ern+ @aa @(d,pc) @@aa mnemonic bor bior bxor bixor bor #xx:3,@aa:8 b 4 bor #xx:3,@aa:16 b 6 bor #xx:3,@aa:32 b 8 bior #xx:3,rd b 2 bior #xx:3,@erd b 4 bior #xx:3,@aa:8 b 4 bior #xx:3,@aa:16 b 6 bior #xx:3,@aa:32 b 8 bxor #xx:3,rd b 2 bxor #xx:3,@erd b 4 bxor #xx:3,@aa:8 b 4 bxor #xx:3,@aa:16 b 6 bxor #xx:3,@aa:32 b 8 bixor #xx:3,rd b 2 bixor #xx:3,@erd b 4 bixor #xx:3,@aa:8 b 4 bixor #xx:3,@aa:16 b 6 bixor #xx:3,@aa:32 b 8 c (#xx:3 of @aa:8) c ? ? ? ? ? 3 c (#xx:3 of @aa:16) c ? ? ? ? ? 4 c (#xx:3 of @aa:32) c ? ? ? ? ? 5 c [ ? (#xx:3 of rd8)] c ? ? ? ? ? 1 c [ ? (#xx:3 of @erd)] c ? ? ? ? ? 3 c [ ? (#xx:3 of @aa:8)] c ? ? ? ? ? 3 c [ ? (#xx:3 of @aa:16)] c ? ? ? ? ? 4 c [ ? (#xx:3 of @aa:32)] c ? ? ? ? ? 5 c (#xx:3 of rd8) c ? ? ? ? ? 1 c (#xx:3 of @erd) c ? ? ? ? ? 3 c (#xx:3 of @aa:8) c ? ? ? ? ? 3 c (#xx:3 of @aa:16) c ? ? ? ? ? 4 c (#xx:3 of @aa:32) c ? ? ? ? ? 5 c [ ? (#xx:3 of rd8)] c ? ? ? ? ? 1 c [ ? (#xx:3 of @erd)] c ? ? ? ? ? 3 c [ ? (#xx:3 of @aa:8)] c ? ? ? ? ? 3 c [ ? (#xx:3 of @aa:16)] c ? ? ? ? ? 4 c [ ? (#xx:3 of @aa:32)] c ? ? ? ? ? 5 operation condition code ihnzvc advanced no. of states * 1 ??????????????????
appendix a instruction set rev.7.00 feb. 14, 2007 page 881 of 1108 rej09b0089-0700 (6) branch instructions addressing mode/ instruction length (bytes) operand size #xx rn @ern @(d,ern) @-ern/@ern+ @aa @(d,pc) @@aa mnemonic bcc always ? ? ? ? ? ? 2 ? ? ? ? ? ? 3 never ? ? ? ? ? ? 2 ? ? ? ? ? ? 3 c z=0 ? ? ? ? ? ? 2 ? ? ? ? ? ? 3 c z=1 ? ? ? ? ? ? 2 ? ? ? ? ? ? 3 c=0 ? ? ? ? ? ? 2 ? ? ? ? ? ? 3 c=1 ? ? ? ? ? ? 2 ? ? ? ? ? ? 3 z=0 ? ? ? ? ? ? 2 ? ? ? ? ? ? 3 z=1 ? ? ? ? ? ? 2 ? ? ? ? ? ? 3 v=0 ? ? ? ? ? ? 2 ? ? ? ? ? ? 3 operation condition code branching condition ihnzvc advanced no. of states * 1 bra d:8(bt d:8) ? 2 if condition is true then bra d:16(bt d:16) ? 4 pc pc+d brn d:8(bf d:8) ? 2 else next; brn d:16(bf d:16) ? 4 bhi d:8 ? 2 bhi d:16 ? 4 bls d:8 ? 2 bls d:16 ? 4 bcc d:b(bhs d:8) ? 2 bcc d:16(bhs d:16) ? 4 bcs d:8(blo d:8) ? 2 bcs d:16(blo d:16) ? 4 bne d:8 ? 2 bne d:16 ? 4 beq d:8 ? 2 beq d:16 ? 4 bvc d:8 ? 2 bvc d:16 ? 4
appendix a instruction set rev.7.00 feb. 14, 2007 page 882 of 1108 rej09b0089-0700 addressing mode/ instruction length (bytes) operand size #xx rn @ern @(d,ern) @-ern/@ern+ @aa @(d,pc) @@aa mnemonic bcc v=1 ? ? ? ? ? ? 2 ? ? ? ? ? ? 3 n=0 ? ? ? ? ? ? 2 ? ? ? ? ? ? 3 n=1 ? ? ? ? ? ? 2 ? ? ? ? ? ? 3 n v=0 ? ? ? ? ? ? 2 ? ? ? ? ? ? 3 n v=1 ? ? ? ? ? ? 2 ? ? ? ? ? ? 3 z (n v)=0 ? ? ? ? ? ? 2 ? ? ? ? ? ? 3 z (n v)=1 ? ? ? ? ? ? 2 ? ? ? ? ? ? 3 operation condition code branching condition ihnzvc advanced no. of states * 1 bvs d:8 ? 2 bvs d:16 ? 4 bpl d:8 ? 2 bpl d:16 ? 4 bmi d:8 ? 2 bmi d:16 ? 4 bge d:8 ? 2 bge d:16 ? 4 blt d:8 ? 2 blt d:16 ? 4 bgt d:8 ? 2 bgt d:16 ? 4 ble d:8 ? 2 ble d:16 ? 4
appendix a instruction set rev.7.00 feb. 14, 2007 page 883 of 1108 rej09b0089-0700 addressing mode/ instruction length (bytes) operand size #xx rn @ern @(d,ern) @-ern/@ern+ @aa @(d,pc) @@aa mnemonic jmp bsr jsr rts jmp @ern ? 2 jmp @aa:24 ? 4 jmp @@aa:8 ? 2 bsr d:8 ? 2 bsr d:16 ? 4 jsr @ern ? 2 jsr @aa:24 ? 4 jsr @@aa:8 ? 2 rts ? 2 pc ern ? ? ? ? ? ? 2 pc aa:24 ? ? ? ? ? ? 3 pc @aa:8 ? ? ? ? ? ? 5 pc @-sp,pc pc+d:8 ? ? ? ? ? ? 4 pc @-sp,pc pc+d:16 ? ? ? ? ? ? 5 pc @-sp,pc ern ? ? ? ? ? ? 4 pc @-sp,pc aa:24 ? ? ? ? ? ? 5 pc @-sp,pc @aa:8 ? ? ? ? ? ? 6 pc @sp+ ? ? ? ? ? ? 5 operation condition code ihnzvc advanced no. of states * 1
appendix a instruction set rev.7.00 feb. 14, 2007 page 884 of 1108 rej09b0089-0700 (7) system control instructions addressing mode/ instruction length (bytes) operand size #xx rn @ern @(d,ern) @-ern/@ern+ @aa @(d,pc) @@aa mnemonic trapa rte sleep ldc trapa #xx:2 ? rte ? sleep ? ldc #xx:8,ccr b 2 ldc #xx:8,exr b 4 ldc rs,ccr b 2 ldc rs,exr b 2 ldc @ers,ccr w 4 ldc @ers,exr w 4 ldc @(d:16,ers),ccr w 6 ldc @(d:16,ers),exr w 6 ldc @(d:32,ers),ccr w 10 ldc @(d:32,ers),exr w 10 ldc @ers+,ccr w 4 ldc @ers+,exr w 4 ldc @aa:16,ccr w 6 ldc @aa:16,exr w 6 ldc @aa:32,ccr w 8 ldc @aa:32,exr w 8 pc @-sp,ccr @-sp, 1 ? ? ? ? ? 8 [9] exr @-sp, pc exr @sp+,ccr @sp+, 5 [9] pc @sp+ transition to power-down state ? ? ? ? ? ? 2 #xx:8 ccr 1 #xx:8 exr ? ? ? ? ? ? 2 rs8 ccr 1 rs8 exr ? ? ? ? ? ? 1 @ers ccr 3 @ers exr ? ? ? ? ? ? 3 @(d:16,ers) ccr 4 @(d:16,ers) exr ? ? ? ? ? ? 4 @(d:32,ers) ccr 6 @(d:32,ers) exr ? ? ? ? ? ? 6 @ers ccr,ers32+2 ers32 4 @ers exr,ers32+2 ers32 ? ? ? ? ? ? 4 @aa:16 ccr 4 @aa:16 exr ? ? ? ? ? ? 4 @aa:32 ccr 5 @aa:32 exr ? ? ? ? ? ? 5 operation condition code ihnzvc advanced no. of states * 1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
appendix a instruction set rev.7.00 feb. 14, 2007 page 885 of 1108 rej09b0089-0700 addressing mode/ instruction length (bytes) operand size #xx rn @ern @(d,ern) @-ern/@ern+ @aa @(d,pc) @@aa mnemonic stc andc orc xorc nop stc ccr,rd b 2 stc exr,rd b 2 stc ccr,@erd w 4 stc exr,@erd w 4 stc ccr,@(d:16,erd) w 6 stc exr,@(d:16,erd) w 6 stc ccr,@(d:32,erd) w 10 stc exr,@(d:32,erd) w 10 stc ccr,@-erd w 4 stc exr,@-erd w 4 stc ccr,@aa:16 w 6 stc exr,@aa:16 w 6 stc ccr,@aa:32 w 8 stc exr,@aa:32 w 8 andc #xx:8,ccr b 2 andc #xx:8,exr b 4 orc #xx:8,ccr b 2 orc #xx:8,exr b 4 xorc #xx:8,ccr b 2 xorc #xx:8,exr b 4 nop ? 2 ccr rd8 ? ? ? ? ? ? 1 exr rd8 ? ? ? ? ? ? 1 ccr @erd ? ? ? ? ? ? 3 exr @erd ? ? ? ? ? ? 3 ccr @(d:16,erd) ? ? ? ? ? ? 4 exr @(d:16,erd) ? ? ? ? ? ? 4 ccr @(d:32,erd) ? ? ? ? ? ? 6 exr @(d:32,erd) ? ? ? ? ? ? 6 erd32-2 erd32,ccr @erd ? ? ? ? ? ? 4 erd32-2 erd32,exr @erd ? ? ? ? ? ? 4 ccr @aa:16 ? ? ? ? ? ? 4 exr @aa:16 ? ? ? ? ? ? 4 ccr @aa:32 ? ? ? ? ? ? 5 exr @aa:32 ? ? ? ? ? ? 5 ccr #xx:8 ccr 1 exr #xx:8 exr ? ? ? ? ? ? 2 ccr #xx:8 ccr 1 exr #xx:8 exr ? ? ? ? ? ? 2 ccr #xx:8 ccr 1 exr #xx:8 exr ? ? ? ? ? ? 2 pc pc+2 ? ? ? ? ? ? 1 operation condition code ihnzvc advanced no. of states * 1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
appendix a instruction set rev.7.00 feb. 14, 2007 page 886 of 1108 rej09b0089-0700 (8) block transfer instructions addressing mode/ instruction length (bytes) operand size #xx rn @ern @(d,ern) @-ern/@ern+ @aa @(d,pc) @@aa mnemonic eepmov notes: 1. the number of states is the number of states required for execution when the instruction and its operands are located in on-chip memory. 2. n is the initial value of r4l or r4. 3. only register er0, er1, er4, or er5 should be used when using the tas instruction. [1] seven states for saving or restoring two registers, nine states for three registers, or eleven states for four registers. [2] cannot be used in the chip. [3] set to 1 when a carry or borrow occurs at bit 11; otherwise cleared to 0. [4] set to 1 when a carry or borrow occurs at bit 27; otherwise cleared to 0. [5] retains its previous value when the result is zero; otherwise cleared to 0. [6] set to 1 when the divisor is negative; otherwise cleared to 0. [7] set to 1 when the divisor is zero; otherwise cleared to 0. [8] set to 1 when the quotient is negative; otherwise cleared to 0. [9] one additional state is required for execution when exr is valid. eepmov.b ? 4 eepmov.w ? 4 if r4l 0 ? ? ? ? ? ? 4+2n * 2 repeat @er5 @er6 er5+1 er5 er6+1 er6 r4l-1 r4l until r4l=0 else next; if r4 0 ? ? ? ? ? ? 4+2n * 2 repeat @er5 @er6 er5+1 er5 er6+1 er6 r4-1 r4 until r4=0 else next; operation condition code ihnzvc advanced no. of states * 1
appendix a instruction set rev.7.00 feb. 14, 2007 page 887 of 1108 rej09b0089-0700 a.2 instruction codes table a.2 shows the instruction codes.
appendix a instruction set rev.7.00 feb. 14, 2007 page 888 of 1108 rej09b0089-0700 table a.2 instruction codes add.b #xx:8,rd add.b rs,rd add.w #xx:16,rd add.w rs,rd add.l #xx:32,erd add.l ers,erd adds #1,erd adds #2,erd adds #4,erd addx #xx:8,rd addx rs,rd and.b #xx:8,rd and.b rs,rd and.w #xx:16,rd and.w rs,rd and.l #xx:32,erd and.l ers,erd andc #xx:8,ccr andc #xx:8,exr band #xx:3,rd band #xx:3,@erd band #xx:3,@aa:8 band #xx:3,@aa:16 band #xx:3,@aa:32 bra d:8 (bt d:8) bra d:16 (bt d:16) brn d:8 (bf d:8) brn d:16 (bf d:16) mnemonic size instruction format 1st byte 2nd byte 3rd byte 4th byte 5th byte 6th byte 7th byte 8th byte 9th byte 10th byte instruc- tion add adds addx and andc band bcc b b w w l l l l l b b b b w w l l b b b b b b b ? ? ? ? 1 0 0 ers imm erd 0 0 0 0 0 0 erd erd erd erd erd erd ers imm imm 0 erd 0 imm 0 imm 0 0 0 8 0 7 0 7 0 0 0 0 9 0 e 1 7 6 7 0 0 0 7 7 7 6 6 4 5 4 5 rd 8 9 9 a a b b b rd e rd 6 9 6 a 1 6 1 6 c e a a 0 8 1 8 rd rd rd rd rd rd rd 0 1 rd 0 0 0 0 0 6 0 7 7 6 6 6 6 0 0 76 0 76 0 imm imm imm imm abs disp disp rs 1 rs 1 0 8 9 rs rs 6 rs 6 f 4 1 3 0 1 imm imm abs disp disp imm imm abs imm
appendix a instruction set rev.7.00 feb. 14, 2007 page 889 of 1108 rej09b0089-0700 bhi d:8 bhi d:16 bls d:8 bls d:16 bcc d:8 (bhs d:8) bcc d:16 (bhs d:16) bcs d:8 (blo d:8) bcs d:16 (blo d:16) bne d:8 bne d:16 beq d:8 beq d:16 bvc d:8 bvc d:16 bvs d:8 bvs d:16 bpl d:8 bpl d:16 bmi d:8 bmi d:16 bge d:8 bge d:16 blt d:8 blt d:16 bgt d:8 bgt d:16 ble d:8 ble d:16 mnemonic size instruction format 1st byte 2nd byte 3rd byte 4th byte 5th byte 6th byte 7th byte 8th byte 9th byte 10th byte instruc- tion bcc ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 2 8 3 8 4 8 5 8 6 8 7 8 8 8 9 8 a 8 b 8 c 8 d 8 e 8 f 8 2 3 4 5 6 7 8 9 a b c d e f disp disp disp disp disp disp disp disp disp disp disp disp disp disp disp disp disp disp disp disp disp disp disp disp disp disp disp disp 0 0 0 0 0 0 0 0 0 0 0 0 0 0
appendix a instruction set rev.7.00 feb. 14, 2007 page 890 of 1108 rej09b0089-0700 bclr #xx:3,rd bclr #xx:3,@erd bclr #xx:3,@aa:8 bclr #xx:3,@aa:16 bclr #xx:3,@aa:32 bclr rn,rd bclr rn,@erd bclr rn,@aa:8 bclr rn,@aa:16 bclr rn,@aa:32 biand #xx:3,rd biand #xx:3,@erd biand #xx:3,@aa:8 biand #xx:3,@aa:16 biand #xx:3,@aa:32 bild #xx:3,rd bild #xx:3,@erd bild #xx:3,@aa:8 bild #xx:3,@aa:16 bild #xx:3,@aa:32 bior #xx:3,rd bior #xx:3,@erd bior #xx:3,@aa:8 bior #xx:3,@aa:16 bior #xx:3,@aa:32 mnemonic size instruction format 1st byte 2nd byte 3rd byte 4th byte 5th byte 6th byte 7th byte 8th byte 9th byte 10th byte instruc- tion bclr biand bild bior b b b b b b b b b b b b b b b b b b b b b b b b b 0 0 0 1 0 1 0 1 0 imm erd erd imm erd imm erd imm erd 0 1 1 1 imm imm imm imm 0 1 1 1 imm imm imm imm 7 7 7 6 6 6 7 7 6 6 7 7 7 6 6 7 7 7 6 6 7 7 7 6 6 2 d f a a 2 d f a a 6 c e a a 7 c e a a 4 c e a a 1 3 rn 1 3 1 3 1 3 1 3 rd 0 8 8 rd 0 8 8 rd 0 0 0 rd 0 0 0 rd 0 0 0 7 7 6 6 7 7 7 7 7 7 2 2 2 2 6 6 7 7 4 4 rn rn 0 0 0 0 0 0 0 0 0 0 7 6 7 7 7 2 2 6 7 4 rn 0 0 0 0 0 7 6 7 7 7 2 2 6 7 4 rn 0 0 0 0 0 abs abs abs abs abs abs abs abs abs abs abs abs abs abs abs 0 0 1 1 1 1 1 1 imm imm imm imm imm imm imm imm
appendix a instruction set rev.7.00 feb. 14, 2007 page 891 of 1108 rej09b0089-0700 bist #xx:3,rd bist #xx:3,@erd bist #xx:3,@aa:8 bist #xx:3,@aa:16 bist #xx:3,@aa:32 bixor #xx:3,rd bixor #xx:3,@erd bixor #xx:3,@aa:8 bixor #xx:3,@aa:16 bixor #xx:3,@aa:32 bld #xx:3,rd bld #xx:3,@erd bld #xx:3,@aa:8 bld #xx:3,@aa:16 bld #xx:3,@aa:32 bnot #xx:3,rd bnot #xx:3,@erd bnot #xx:3,@aa:8 bnot #xx:3,@aa:16 bnot #xx:3,@aa:32 bnot rn,rd bnot rn,@erd bnot rn,@aa:8 bnot rn,@aa:16 bnot rn,@aa:32 mnemonic size instruction format 1st byte 2nd byte 3rd byte 4th byte 5th byte 6th byte 7th byte 8th byte 9th byte 10th byte instruc- tion bist bixor bld bnot b b b b b b b b b b b b b b b b b b b b b b b b b 1 0 1 0 0 0 0 0 0 imm erd imm erd imm erd imm erd erd imm imm imm imm imm imm imm imm 1 1 0 0 imm imm imm imm 1 1 0 0 imm imm imm imm 1 1 1 1 0 0 0 0 6 7 7 6 6 7 7 7 6 6 7 7 7 6 6 7 7 7 6 6 6 7 7 6 6 7 d f a a 5 c e a a 7 c e a a 1 d f a a 1 d f a a 1 3 1 3 1 3 1 3 rn 1 3 rd 0 8 8 rd 0 0 0 rd 0 0 0 rd 0 8 8 rd 0 8 8 6 6 7 7 7 7 7 7 6 6 7 7 5 5 7 7 1 1 1 1 rn rn 0 0 0 0 0 0 0 0 0 0 6 7 7 7 6 7 5 7 1 1rn 0 0 0 0 0 6 7 7 7 6 7 5 7 1 1rn 0 0 0 0 0 abs abs abs abs abs abs abs abs abs abs abs abs abs abs abs
appendix a instruction set rev.7.00 feb. 14, 2007 page 892 of 1108 rej09b0089-0700 bor #xx:3,rd bor #xx:3,@erd bor #xx:3,@aa:8 bor #xx:3,@aa:16 bor #xx:3,@aa:32 bset #xx:3,rd bset #xx:3,@erd bset #xx:3,@aa:8 bset #xx:3,@aa:16 bset #xx:3,@aa:32 bset rn,rd bset rn,@erd bset rn,@aa:8 bset rn,@aa:16 bset rn,@aa:32 bsr d:8 bsr d:16 bst #xx:3,rd bst #xx:3,@erd bst #xx:3,@aa:8 bst #xx:3,@aa:16 bst #xx:3,@aa:32 btst #xx:3,rd btst #xx:3,@erd btst #xx:3,@aa:8 btst #xx:3,@aa:16 btst #xx:3,@aa:32 btst rn,rd btst rn,@erd mnemonic size instruction format 1st byte 2nd byte 3rd byte 4th byte 5th byte 6th byte 7th byte 8th byte 9th byte 10th byte instruc- tion bor bset bsr bst btst b b b b b b b b b b b b b b b ? ? b b b b b b b b b b b b 0 0 0 0 0 0 0 0 0 0 imm erd imm erd erd imm erd imm erd erd abs abs abs disp abs abs imm imm imm imm imm imm imm imm 0 0 0 0 imm imm imm imm 0 0 0 0 imm imm imm imm 0 0 0 0 0 0 0 0 7 7 7 6 6 7 7 7 6 6 6 7 7 6 6 5 5 6 7 7 6 6 7 7 7 6 6 6 7 4 c e a a 0 d f a a 0 d f a a 5 c 7 d f a a 3 c e a a 3 c 1 3 1 3 rn 1 3 0 1 3 1 3 rn rd 0 0 0 rd 0 8 8 rd 0 8 8 0 rd 0 8 8 rd 0 0 0 rd 0 7 7 7 7 6 6 6 6 7 7 6 4 4 0 0 0 0 7 7 3 3 3 rn rn rn 0 0 0 0 0 0 0 0 0 0 0 7 7 6 6 7 4 0 0 7 3 rn 0 0 0 0 0 7 7 6 6 7 4 0 0 7 3 rn 0 0 0 0 0 abs abs abs disp abs abs abs abs abs abs abs
appendix a instruction set rev.7.00 feb. 14, 2007 page 893 of 1108 rej09b0089-0700 btst rn,@aa:8 btst rn,@aa:16 btst rn,@aa:32 bxor #xx:3,rd bxor #xx:3,@erd bxor #xx:3,@aa:8 bxor #xx:3,@aa:16 bxor #xx:3,@aa:32 clrmac cmp.b #xx:8,rd cmp.b rs,rd cmp.w #xx:16,rd cmp.w rs,rd cmp.l #xx:32,erd cmp.l ers,erd daa rd das rd dec.b rd dec.w #1,rd dec.w #2,rd dec.l #1,erd dec.l #2,erd divxs.b rs,rd divxs.w rs,erd divxu.b rs,rd divxu.w rs,erd eepmov.b eepmov.w mnemonic size instruction format 1st byte 2nd byte 3rd byte 4th byte 5th byte 6th byte 7th byte 8th byte 9th byte 10th byte instruc- tion btst bxor clrmac cmp daa das dec divxs divxu eepmov b b b b b b b b ? b b w w l l b b b w w l l b w b w ? ? 0 0 1 imm erd ers 0 0 0 0 0 erd erd erd erd erd imm imm 0 erd 0 imm 0 imm 0 0 7 6 6 7 7 7 6 6 a 1 7 1 7 1 0 1 1 1 1 1 1 0 0 5 5 7 7 e a a 5 c e a a rd c 9 d a f f f a b b b b 1 1 1 3 b b 1 3 1 3 rs 2 rs 2 0 0 0 5 d 7 f d d rs rs 5 d 0 0 rd 0 0 0 rd rd rd rd rd rd rd rd 0 0 rd c 4 6 7 7 5 5 5 5 3 5 5 1 3 9 9 rn rs rs 8 8 0 0 0 rd f f 6 7 3 5 rn 0 0 6 7 3 5 rn 0 0 abs abs imm abs abs imm abs abs imm cannot be used in the chip
appendix a instruction set rev.7.00 feb. 14, 2007 page 894 of 1108 rej09b0089-0700 e x t s . w rd e x t s .l e rd e x t u . w rd e x t u .l e rd in c . b rd in c . w #1,rd in c . w #2,rd in c .l #1, e rd in c .l #2, e rd jmp @ e rn jmp @aa : 2 4 jmp @@aa : 8 jsr @ e rn jsr @aa : 2 4 jsr @@aa : 8 l dc #xx : 8,ccr l dc #xx : 8, e xr l dc rs,ccr l dc rs, e xr l dc @ e rs,ccr l dc @ e rs, e xr l dc @(d : 16, e rs),ccr l dc @(d : 16, e rs), e xr l dc @(d : 32, e rs),ccr l dc @(d : 32, e rs), e xr l dc @ e rs + ,ccr l dc @ e rs + , e xr l dc @aa : 16,ccr l dc @aa : 16, e xr m n e mon i c s i z e i nstruct i on f ormat 1st byt e 2nd byt e 3rd byt e4 th byt e 5th byt e 6th byt e 7th byt e 8th byt e 9th byt e 10th byt e i nstruc - t i on e x t s e x t u in c jmp jsr l dc w l w l b w w l l ? ? ? ? ? ? b b b b w w w w w w w w w w 0 0 ern ern 0 0 0 0 erd erd erd erd ers ers ers ers ers ers ers ers 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 5 5 5 5 5 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 7 7 7 a b b b b 9 a b d e f 7 1 3 3 1 1 1 1 1 1 1 1 1 1 d f 5 7 0 5 d 7 f 4 0 1 4 4 4 4 4 4 4 4 4 4 rd rd rd rd rd 0 0 1 rs rs 0 1 0 1 0 1 0 1 0 1 0 6 6 6 6 7 7 6 6 6 6 7 9 9 f f 8 8 d d b b 0 0 0 0 0 0 0 0 0 0 0 0 6 6 b b 2 2 0 0 abs abs abs abs i mm i mm d i sp d i sp abs abs d i sp d i sp
appendix a instruction set rev.7.00 feb. 14, 2007 page 895 of 1108 rej09b0089-0700 0 0 rd abs rs rd ldc @aa:32,ccr ldc @aa:32,exr ldm.l @sp+, (ern-ern+1) ldm.l @sp+, (ern-ern+2) ldm.l @sp+, (ern-ern+3) ldmac ers,mach ldmac ers,macl mac @ern+,@erm+ mov.b #xx:8,rd mov.b rs,rd mov.b @ers,rd mov.b @(d:16,ers),rd mov.b @(d:32,ers),rd mov.b @ers+,rd mov.b @aa:8,rd mov.b @aa:16,rd mov.b @aa:32,rd mov.b rs,@erd mov.b rs,@(d:16,erd) mov.b rs,@(d:32,erd) mov.b rs,@-erd mov.b rs,@aa:8 mov.b rs,@aa :16 mov.b rs,@aa:32 mov.w #xx:16,rd mov.w rs,rd mov.w @ers,rd mov.w @(d:16,ers),rd mov.w @(d:32,ers),rd mnemonic size instruction format 1st byte 2nd byte 3rd byte 4th byte 5th byte 6th byte 7th byte 8th byte 9th byte 10th byte instruc- tion ldc ldm ldmac mac mov w w l l l l l ? b b b b b b b b b b b b b b b b w w w w w 0 0 0 0 1 1 0 1 0 0 0 ers ers ers ers erd erd erd erd ers ers ers 0 0 0 ern+1 ern+2 ern+3 0 0 0 0 0 f 0 6 6 7 6 2 6 6 6 6 7 6 3 6 6 7 0 6 6 7 1 1 1 1 1 rd c 8 e 8 c rd a a 8 e 8 c rs a a 9 d 9 f 8 4 4 1 2 3 rs 0 2 8 a 0 rs 0 1 0 0 0 rd rd rd 0 rd rd rd rs rs 0 rs rs rs rd rd rd rd 0 6 6 6 6 6 6 6 6 b b d d d a a b 2 2 7 7 7 2 a 2 imm abs abs disp abs disp abs imm disp abs abs abs abs disp disp disp cannot be used in the chip
appendix a instruction set rev.7.00 feb. 14, 2007 page 896 of 1108 rej09b0089-0700 mov.w @ers+,rd mov.w @aa:16,rd mov.w @aa:32,rd mov.w rs,@erd mov.w rs,@(d:16,erd) mov.w rs,@(d:32,erd) mov.w rs,@-erd mov.w rs,@aa:16 mov.w rs,@aa:32 mov.l #xx:32,rd mov.l ers,erd mov.l @ers,erd mov.l @(d:16,ers),erd mov.l @(d:32,ers),erd mov.l @ers+,erd mov.l @aa:16 ,erd mov.l @aa:32 ,erd mov.l ers,@erd mov.l ers,@(d:16,erd) mov.l ers,@(d:32,erd) * 1 mov.l ers,@-erd mov.l ers,@aa:16 mov.l ers,@aa:32 movfpe @aa:16,rd movtpe rs,@aa:16 mulxs.b rs,rd mulxs.w rs,erd mulxu.b rs,rd mulxu.w rs,erd mnemonic size instruction format 1st byte 2nd byte 3rd byte 4th byte 5th byte 6th byte 7th byte 8th byte 9th byte 10th byte instruc- tion mov movfpe movtpe mulxs mulxu w w w w w w w w w l l l l l l l l l l l l l l b b b w b w 0 1 1 0 1 1 ers erd erd erd erd ers 0 0 0 erd erd erd ers ers ers ers erd erd erd erd 0 0 0 0 0 0 0 0 0 0 0 erd erd erd erd erd ers ers ers ers ers erd 0 0 erd ers 0 0 0 0 1 1 0 1 6 6 6 6 6 7 6 6 6 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 5 d b b 9 f 8 d b b a f 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 2 0 2 8 a 0 0 0 0 0 0 0 0 0 0 0 0 0 c c rs rs rd rd rd rs rs 0 rs rs rs 0 0 0 0 0 0 0 0 0 0 0 0 0 0 rd 6 6 6 7 6 6 6 6 6 7 6 6 6 5 5 b 9 f 8 d b b 9 f 8 d b b 0 2 a 0 2 8 a rs rs rs 0 0 rd 6 6 b b 2 a abs disp abs abs abs imm disp abs disp abs disp abs abs cannot be used in the chip disp disp
appendix a instruction set rev.7.00 feb. 14, 2007 page 897 of 1108 rej09b0089-0700 neg.b rd neg.w rd neg.l erd nop not.b rd not.w rd not.l erd or.b #xx:8,rd or.b rs,rd or.w #xx:16,rd or.w rs,rd or.l #xx:32,erd or.l ers,erd orc #xx:8,ccr orc #xx:8,exr pop.w rn pop.l ern push.w rn push.l ern rotl.b rd rotl.b #2, rd rotl.w rd rotl.w #2, rd rotl.l erd rotl.l #2, erd mnemonic size instruction format 1st byte 2nd byte 3rd byte 4th byte 5th byte 6th byte 7th byte 8th byte 9th byte 10th byte instruc- tion neg nop not or orc pop push rotl b w l ? b w l b b w w l l b b w l w l b b w w l l 0 0 0 0 0 erd erd erd erd erd 1 1 1 0 1 1 1 c 1 7 6 7 0 0 0 6 0 6 0 1 1 1 1 1 1 7 7 7 0 7 7 7 rd 4 9 4 a 1 4 1 d 1 d 1 2 2 2 2 2 2 8 9 b 0 0 1 3 rs 4 rs 4 f 4 7 0 f 0 8 c 9 d b f rd rd 0 rd rd rd rd rd 0 1 rn 0 rn 0 rd rd rd rd imm imm 6 0 6 6 4 4 d d ers 0 0 0 erd ern ern 0 7 f imm imm imm
appendix a instruction set rev.7.00 feb. 14, 2007 page 898 of 1108 rej09b0089-0700 rotr.b rd rotr.b #2, rd rotr.w rd rotr.w #2, rd rotr.l erd rotr.l #2, erd rotxl.b rd rotxl.b #2, rd rotxl.w rd rotxl.w #2, rd rotxl.l erd rotxl.l #2, erd rotxr.b rd rotxr.b #2, rd rotxr.w rd rotxr.w #2, rd rotxr.l erd rotxr.l #2, erd rte rts shal.b rd shal.b #2, rd shal.w rd shal.w #2, rd shal.l erd shal.l #2, erd mnemonic size instruction format 1st byte 2nd byte 3rd byte 4th byte 5th byte 6th byte 7th byte 8th byte 9th byte 10th byte instruc- tion rotr rotxl rotxr rte rts shal b b w w l l b b w w l l b b w w l l ? ? b b w w l l 0 0 0 0 0 0 0 0 erd erd erd erd erd erd erd erd 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 5 5 1 1 1 1 1 1 3 3 3 3 3 3 2 2 2 2 2 2 3 3 3 3 3 3 6 4 0 0 0 0 0 0 8 c 9 d b f 0 4 1 5 3 7 0 4 1 5 3 7 7 7 8 c 9 d b f rd rd rd rd rd rd rd rd rd rd rd rd 0 0 rd rd rd rd
appendix a instruction set rev.7.00 feb. 14, 2007 page 899 of 1108 rej09b0089-0700 shar.b rd shar.b #2, rd shar.w rd shar.w #2, rd shar.l erd shar.l #2, erd shll.b rd shll.b #2, rd shll.w rd shll.w #2, rd shll.l erd shll.l #2, erd shlr.b rd shlr.b #2, rd shlr.w rd shlr.w #2, rd shlr.l erd shlr.l #2, erd sleep stc.b ccr,rd stc.b exr,rd stc.w ccr,@erd stc.w exr,@erd stc.w ccr,@(d:16,erd) stc.w exr,@(d:16,erd) stc.w ccr,@(d:32,erd) stc.w exr,@(d:32,erd) stc.w ccr,@-erd stc.w exr,@-erd mnemonic size instruction format 1st byte 2nd byte 3rd byte 4th byte 5th byte 6th byte 7th byte 8th byte 9th byte 10th byte instruc- tion shar shll shlr sleep stc b b w w l l b b w w l l b b w w l l ? b b w w w w w w w w 0 0 0 0 0 0 erd erd erd erd erd erd 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 1 1 8 c 9 d b f 0 4 1 5 3 7 0 4 1 5 3 7 8 0 1 4 4 4 4 4 4 4 4 rd rd rd rd rd rd rd rd rd rd rd rd 0 rd rd 0 1 0 1 0 1 0 1 erd erd erd erd erd erd erd erd 1 1 1 1 0 0 1 1 6 6 6 6 7 7 6 6 9 9 f f 8 8 d d 0 0 0 0 0 0 0 0 6 6 b b a a 0 0 disp disp disp disp
appendix a instruction set rev.7.00 feb. 14, 2007 page 900 of 1108 rej09b0089-0700 stc.w ccr,@aa:16 stc.w exr,@aa:16 stc.w ccr,@aa:32 stc.w exr,@aa:32 stm.l(ern-ern+1), @-sp stm.l (ern-ern+2), @-sp stm.l (ern-ern+3), @-sp stmac mach,erd stmac macl,erd sub.b rs,rd sub.w #xx:16,rd sub.w rs,rd sub.l #xx:32,erd sub.l ers,erd subs #1,erd subs #2,erd subs #4,erd subx #xx:8,rd subx rs,rd tas @erd * 2 trapa #x:2 xor.b #xx:8,rd xor.b rs,rd xor.w #xx:16,rd xor.w rs,rd xor.l #xx:32,erd xor.l ers,erd mnemonic size instruction format 1st byte 2nd byte 3rd byte 4th byte 5th byte 6th byte 7th byte 8th byte 9th byte 10th byte instruc- tion stc stm stmac sub subs subx tas trapa xor w w w w l l l l l b w w l l l l l b b b ? b b w w l l 1 00 ers imm 0 0 0 0 0 0 erd erd erd erd erd erd erd ers 0 0 0 0 ern ern ern erd 0 0 0 0 0 0 0 0 0 1 7 1 7 1 1 1 1 b 1 0 5 d 1 7 6 7 0 1 1 1 1 1 1 1 8 9 9 a a b b b rd e 1 7 rd 5 9 5 a 1 4 4 4 4 1 2 3 rs 3 rs 3 0 8 9 rs e rs 5 rs 5 f 0 1 0 1 0 0 0 rd rd rd rd 0 0 rd rd rd 0 6 6 6 6 6 6 6 7 6 b b b b d d d b 5 8 8 a a f f f 0 0 0 0 c abs abs abs abs imm imm imm imm imm imm cannot be used in the chip
appendix a instruction set rev.7.00 feb. 14, 2007 page 901 of 1108 rej09b0089-0700 xorc #xx:8,ccr xorc #xx:8,exr mnemonic size instruction format 1st byte 2nd byte 3rd byte 4th byte 5th byte 6th byte 7th byte 8th byte 9th byte 10th byte instruc- tion xorc b b 0 0 5 1 4 1 0 5 imm imm notes: 1. bit 7 of the 4th byte of the mov.l ers, @(d:32,erd) instruction can be either 1 or 0. 2. only register er0, er1, er4, or er5 should be used when using the tas instruction. legend: address register 32-bit register register field general register register field general register register field general register 000 001 111 er0 er1 er7 0000 0001 0111 1000 1001 1111 r0 r1 r7 e0 e1 e7 0000 0001 0111 1000 1001 1111 r0h r1h r7h r0l r1l r7l 16-bit register 8-bit register imm: abs: disp: rs, rd, rn: ers, erd, ern, erm: the register fields specify general registers as follows. immediate data (2, 3, 8, 16, or 32 bits) absolute address (8, 16, 24, or 32 bits) displacement (8, 16, or 32 bits) register field (4 bits specifying an 8-bit or 16-bit register. the symbols rs, rd, and rn correspond to operand symbols rs, rd, and rn.) register field (3 bits specifying an address register or 32-bit register. the symbols ers, erd, ern, and erm correspond to oper and symbols ers, erd, ern, and erm.)
appendix a instruction set rev.7.00 feb. 14, 2007 page 902 of 1108 rej09b0089-0700 a.3 operation code map table a.3 shows the operation code map. table a.3 operation code map (1) instruction code 1st byte 2nd byte ah al bh bl instruction when most significant bit of bh is 0. instruction when most significant bit of bh is 1. 0 nop bra mulxu bset ah note: * cannot be used in the chip. al 0 1 2 3 4 5 6 7 8 9 a b c d e f 1 brn divxu bnot 2 bhi mulxu bclr 3 bls divxu btst stc stmac ldc ldmac 4 orc or bcc rts or bor bior 6 andc and bne rte and 5 xorc xor bcs bsr xor bxor bixor band biand 7 ldc beq trapa bst bist bld bild 8 bvc mov 9 bvs a bpl jmp b bmi eepmov c bge bsr d blt mov e addx subx bgt jsr f ble mov.b add addx cmp subx or xor and mov add sub mov mov cmp table a.3(2) table a.3(2) table a.3(2) table a.3(2) table a.3(2) table a.3(2) table a.3(2) table a.3(2) table a.3(2) table a.3(2) table a.3(2) table a.3(2) table a.3(2) table a.3(2) table a.3(2) table a.3(2) table a.3(3) **
appendix a instruction set rev.7.00 feb. 14, 2007 page 903 of 1108 rej09b0089-0700 table a.3 operation code map (2) instruction code 1st byte 2nd byte ah al bh bl 01 0a 0b 0f 10 11 12 13 17 1a 1b 1f 58 6a 79 7a 0 mov inc adds daa dec subs das bra mov mov mov shll shlr rotxl rotxr not 1 ldm brn add add 2 bhi mov cmp cmp 3 stm not bls sub sub 4 shll shlr rotxl rotxr bcc movfpe * or or 5 inc extu dec bcs xor xor 6 mac bne and and 7 inc shll shlr rotxl rotxr extu dec beq ldc stc 8 sleep bvc mov adds shal shar rotl rotr neg subs 9 bvs a clrmac bpl mov b neg bmi add mov sub cmp c shal shar rotl rotr bge movtpe * d inc exts dec blt e tas bgt f inc shal shar rotl rotr exts dec ble bh ah al table a.3(3) table a.3(3) table a.3(3) table a.3(4) table a.3(4) * * note: * cannot be used in the chip.
appendix a instruction set rev.7.00 feb. 14, 2007 page 904 of 1108 rej09b0089-0700 table a.3 operation code map (3) instruction code 1st byte 2nd byte ah al bh bl 3rd byte 4th byte ch cl dh dl r is the register specification field. aa is the absolute address specification. instruction when most significant bit of dh is 0. instruction when most significant bit of dh is 1. notes: ah al bh bl ch cl 01c05 01d05 01f06 7cr06 * 1 7cr07 * 1 7dr06 * 1 7dr07 * 1 7eaa6 * 2 7eaa7 * 2 7faa6 * 2 7faa7 * 2 0 mulxs bset bset bset bset 1 divxs bnot bnot bnot bnot 2 mulxs bclr bclr bclr bclr 3 divxs btst btst btst btst 4 or 5 xor 6 and 789abcdef 1. 2. bor bior bxor bixor band biand bld bild bst bist bor bior bxor bixor band biand bld bild bst bist
appendix a instruction set rev.7.00 feb. 14, 2007 page 905 of 1108 rej09b0089-0700 table a.3 operation code map (4) instruction code 1st byte 2nd byte ah al bh bl 3rd byte 4th byte ch cl dh dl instruction when most significant bit of fh is 0. instruction when most significant bit of fh is 1. 5th byte 6th byte eh el fh fl instruction code 1st byte 2nd byte ah al bh bl 3rd byte 4th byte ch cl dh dl instruction when most significant bit of hh is 0. instruction when most significant bit of hh is 1. note: * aa is the absolute address specification. 5th byte 6th byte eh el fh fl 7th byte 8th byte gh gl hh hl 6a10aaaa6 * 6a10aaaa7 * 6a18aaaa6 * 6a18aaaa7 * ahalbhblchcldhdleh el 0 bset 1 bnot 2 bclr 3 btst bor bior bxor bixor band biand bld bild bst bist 456789abcdef 6a30aaaaaaaa6 * 6a30aaaaaaaa7 * 6a38aaaaaaaa6 * 6a38aaaaaaaa7 * ahalbhbl ... fhflgh gl 0 bset 1 bnot 2 bclr 3 btst bor bior bxor bixor band biand bld bild bst bist 456789abcdef
appendix a instruction set rev.7.00 feb. 14, 2007 page 906 of 1108 rej09b0089-0700 a.4 number of states required for instruction execution the tables in this section can be used to calcula te the number of states required for instruction execution by the cpu. table a.5 indicates the number of instruction fetch, data read/write, and other cycles occurring in each instruction. table a.4 indicates the number of states required for each cycle. the number of states required for execution of an instruction can be calculated from these two tables as follows: execution states = i s i + j s j + k s k + l s l + m s m + n s n examples: advanced mode, program code, and stack located in external memory, on-chip supporting modules accessed in two states with 8-bit bus width, external devices accessed in three states with one wait state and 16-bit bus width. 1. bset #0, @ffffc7:8 from table a.5: i = l = 2, j = k = m = n = 0 from table a.4: s i = 4, s l = 2 number of states required for execution = 2 4 + 2 2 = 12 2. jsr @@30 from table a.5: i = j = k = 2, l = m = n = 0 from table a.4: s i = s j = s k = 4 number of states required for execution = 2 4 + 2 4 + 2 4 = 24
appendix a instruction set rev.7.00 feb. 14, 2007 page 907 of 1108 rej09b0089-0700 table a.4 number of states per cycle access conditions external device on-chip supporting module 8-bit bus 16-bit bus cycle on-chip memory 8-bit bus 16-bit bus 2-state access 3-state access 2-state access 3-state access instruction fetch s i 1 4 2 4 6 + 2m 2 3 + m branch address read s j stack operation s k byte data access s l 2 2 3 + m word data access s m 4 4 6 + 2m internal operation s n 1 1 1 1 1 1 1 legend: m: number of wait states inserted into external device access
appendix a instruction set rev.7.00 feb. 14, 2007 page 908 of 1108 rej09b0089-0700 table a.5 number of cycles in instruction execution instruction fetch branch address read stack operation byte data access word data access internal operation instruction mnemonic i j k l m n add add.b #xx:8,rd 1 add.b rs,rd 1 add.w #xx:16,rd 2 add.w rs,rd 1 add.l #xx:32,erd 3 add.l ers,erd 1 adds adds #1/2/4,erd 1 addx addx #xx:8,rd 1 addx rs,rd 1 and and.b #xx:8,rd 1 and.b rs,rd 1 and.w #xx:16,rd 2 and.w rs,rd 1 and.l #xx:32,erd 3 and.l ers,erd 2 andc andc #xx:8,ccr 1 andc #xx:8,exr 2 band band #xx:3,rd 1 band #xx:3,@erd 2 1 band #xx:3,@aa:8 2 1 band #xx:3,@aa:16 3 1 band #xx:3,@aa:32 4 1 bcc bra d:8 (bt d:8) 2 brn d:8 (bf d:8) 2 bhi d:8 2 bls d:8 2 bcc d:8 (bhs d:8) 2 bcs d:8 (blo d:8) 2 bne d:8 2 beq d:8 2 bvc d:8 2
appendix a instruction set rev.7.00 feb. 14, 2007 page 909 of 1108 rej09b0089-0700 instruction fetch branch address read stack operation byte data access word data access internal operation instruction mnemonic i j k l m n bcc bvs d:8 2 bpl d:8 2 bmi d:8 2 bge d:8 2 blt d:8 2 bgt d:8 2 ble d:8 2 bra d:16 (bt d:16) 2 1 brn d:16 (bf d:16) 2 1 bhi d:16 2 1 bls d:16 2 1 bcc d:16 (bhs d:16) 2 1 bcs d:16 (blo d:16) 2 1 bne d:16 2 1 beq d:16 2 1 bvc d:16 2 1 bvs d:16 2 1 bpl d:16 2 1 bmi d:16 2 1 bge d:16 2 1 blt d:16 2 1 bgt d:16 2 1 ble d:16 2 1 bclr bclr #xx:3,rd 1 bclr #xx:3,@erd 2 2 bclr #xx:3,@aa:8 2 2 bclr #xx:3,@aa:16 3 2 bclr #xx:3,@aa:32 4 2 bclr rn,rd 1 bclr rn,@erd 2 2 bclr rn,@aa:8 2 2 bclr rn,@aa:16 3 2 bclr rn,@aa:32 4 2
appendix a instruction set rev.7.00 feb. 14, 2007 page 910 of 1108 rej09b0089-0700 instruction fetch branch address read stack operation byte data access word data access internal operation instruction mnemonic i j k l m n biand biand #xx:3,rd 1 biand #xx:3,@erd 2 1 biand #xx:3,@aa:8 2 1 biand #xx:3,@aa:16 3 1 biand #xx:3,@aa:32 4 1 bild bild #xx:3,rd 1 bild #xx:3,@erd 2 1 bild #xx:3,@aa:8 2 1 bild #xx:3,@aa:16 3 1 bild #xx:3,@aa:32 4 1 bior bior #xx:8,rd 1 bior #xx:8,@erd 2 1 bior #xx:8,@aa:8 2 1 bior #xx:8,@aa:16 3 1 bior #xx:8,@aa:32 4 1 bist bist #xx:3,rd 1 bist #xx:3,@erd 2 2 bist #xx:3,@aa:8 2 2 bist #xx:3,@aa:16 3 2 bist #xx:3,@aa:32 4 2 bixor bixor #xx:3,rd 1 bixor #xx:3,@erd 2 1 bixor #xx:3,@aa:8 2 1 bixor #xx:3,@aa:16 3 1 bixor #xx:3,@aa:32 4 1 bld bld #xx:3,rd 1 bld #xx:3,@erd 2 1 bld #xx:3,@aa:8 2 1 bld #xx:3,@aa:16 3 1 bld #xx:3,@aa:32 4 1
appendix a instruction set rev.7.00 feb. 14, 2007 page 911 of 1108 rej09b0089-0700 instruction fetch branch address read stack operation byte data access word data access internal operation instruction mnemonic i j k l m n bnot bnot #xx:3,rd 1 bnot #xx:3,@erd 2 2 bnot #xx:3,@aa:8 2 2 bnot #xx:3,@aa:16 3 2 bnot #xx:3,@aa:32 4 2 bnot rn,rd 1 bnot rn,@erd 2 2 bnot rn,@aa:8 2 2 bnot rn,@aa:16 3 2 bnot rn,@aa:32 4 2 bor bor #xx:3,rd 1 bor #xx:3,@erd 2 1 bor #xx:3,@aa:8 2 1 bor #xx:3,@aa:16 3 1 bor #xx:3,@aa:32 4 1 bset bset #xx:3,rd 1 bset #xx:3,@erd 2 2 bset #xx:3,@aa:8 2 2 bset #xx:3,@aa:16 3 2 bset #xx:3,@aa:32 4 2 bset rn,rd 1 bset rn,@erd 2 2 bset rn,@aa:8 2 2 bset rn,@aa:16 3 2 bset rn,@aa:32 4 2 bsr bsr d:8 2 2 bsr d:16 2 2 1 bst bst #xx:3,rd 1 bst #xx:3,@erd 2 2 bst #xx:3,@aa:8 2 2 bst #xx:3,@aa:16 3 2 bst #xx:3,@aa:32 4 2
appendix a instruction set rev.7.00 feb. 14, 2007 page 912 of 1108 rej09b0089-0700 instruction fetch branch address read stack operation byte data access word data access internal operation instruction mnemonic i j k l m n btst btst #xx:3,rd 1 btst #xx:3,@erd 2 1 btst #xx:3,@aa:8 2 1 btst #xx:3,@aa:16 3 1 btst #xx:3,@aa:32 4 1 btst rn,rd 1 btst rn,@erd 2 1 btst rn,@aa:8 2 1 btst rn,@aa:16 3 1 btst rn,@aa:32 4 1 bxor bxor #xx:3,rd 1 bxor #xx:3,@erd 2 1 bxor #xx:3,@aa:8 2 1 bxor #xx:3,@aa:16 3 1 bxor #xx:3,@aa:32 4 1 clrmac clrmac cannot be used in the chip cmp cmp.b #xx:8,rd 1 cmp.b rs,rd 1 cmp.w #xx:16,rd 2 cmp.w rs,rd 1 cmp.l #xx:32,erd 3 cmp.l ers,erd 1 daa daa rd 1 das das rd 1 dec dec.b rd 1 dec.w #1/2,rd 1 dec.l #1/2,erd 1 divxs divxs.b rs,rd 2 11 divxs.w rs,erd 2 19 divxu divxu.b rs,rd 1 11 divxu.w rs,erd 1 19
appendix a instruction set rev.7.00 feb. 14, 2007 page 913 of 1108 rej09b0089-0700 instruction fetch branch address read stack operation byte data access word data access internal operation instruction mnemonic i j k l m n eepmov eepmov.b 2 2n+2 * 2 eepmov.w 2 2n+2 * 2 exts exts.w rd 1 exts.l erd 1 extu extu.w rd 1 extu.l erd 1 inc inc.b rd 1 inc.w #1/2,rd 1 inc.l #1/2,erd 1 jmp jmp @ern 2 jmp @aa:24 2 1 jmp @@aa:8 2 2 1 jsr jsr @ern 2 2 jsr @aa:24 2 2 1 jsr @@aa:8 2 2 2 ldc ldc #xx:8,ccr 1 ldc #xx:8,exr 2 ldc rs,ccr 1 ldc rs,exr 1 ldc @ers,ccr 2 1 ldc @ers,exr 2 1 ldc @(d:16,ers),ccr 3 1 ldc @(d:16,ers),exr 3 1 ldc @(d:32,ers),ccr 5 1 ldc @(d:32,ers),exr 5 1 ldc @ers+,ccr 2 1 1 ldc @ers+,exr 2 1 1 ldc @aa:16,ccr 3 1 ldc @aa:16,exr 3 1 ldc @aa:32,ccr 4 1 ldc @aa:32,exr 4 1
appendix a instruction set rev.7.00 feb. 14, 2007 page 914 of 1108 rej09b0089-0700 instruction fetch branch address read stack operation byte data access word data access internal operation instruction mnemonic i j k l m n ldm ldm.l @sp+, (ern-ern+1) 2 4 1 ldm.l @sp+, (ern-ern+2) 2 6 1 ldm.l @sp+, (ern-ern+3) 2 8 1 ldmac ldmac ers,mach cannot be used in the chip ldmac ers,macl mac mac @ern+,@erm+ cannot be used in the chip mov mov.b #xx:8,rd 1 mov.b rs,rd 1 mov.b @ers,rd 1 1 mov.b @(d:16,ers),rd 2 1 mov.b @(d:32,ers),rd 4 1 mov.b @ers+,rd 1 1 1 mov.b @aa:8,rd 1 1 mov.b @aa:16,rd 2 1 mov.b @aa:32,rd 3 1 mov.b rs,@erd 1 1 mov.b rs,@(d:16,erd) 2 1 mov.b rs,@(d:32,erd) 4 1 mov.b rs,@-erd 1 1 1 mov.b rs,@aa:8 1 1 mov.b rs,@aa:16 2 1 mov.b rs,@aa:32 3 1 mov.w #xx:16,rd 2 mov.w rs,rd 1 mov.w @ers,rd 1 1 mov.w @(d:16,ers),rd 2 1 mov.w @(d:32,ers),rd 4 1 mov.w @ers+,rd 1 1 1 mov.w @aa:16,rd 2 1 mov.w @aa:32,rd 3 1 mov.w rs,@erd 1 1
appendix a instruction set rev.7.00 feb. 14, 2007 page 915 of 1108 rej09b0089-0700 instruction fetch branch address read stack operation byte data access word data access internal operation instruction mnemonic i j k l m n mov mov.w rs,@(d:16,erd) 2 1 mov.w rs,@(d:32,erd) 4 1 mov.w rs,@-erd 1 1 1 mov.w rs,@aa:16 2 1 mov.w rs,@aa:32 3 1 mov.l #xx:32,erd 3 mov.l ers,erd 1 mov.l @ers,erd 2 2 mov.l @(d:16,ers),erd 3 2 mov.l @(d:32,ers),erd 5 2 mov.l @ers+,erd 2 2 1 mov.l @aa:16,erd 3 2 mov.l @aa:32,erd 4 2 mov.l ers,@erd 2 2 mov.l ers,@(d:16,erd) 3 2 mov.l ers,@(d:32,erd) 5 2 mov.l ers,@-erd 2 2 1 mov.l ers,@aa:16 3 2 mov.l ers,@aa:32 4 2 movfpe movfpe @:aa:16,rd can not be used in the chip movtpe movtpe rs,@:aa:16 mulxs mulxs.b rs,rd 2 11 mulxs.w rs,erd 2 19 mulxu mulxu.b rs,rd 1 11 mulxu.w rs,erd 1 19 neg neg.b rd 1 neg.w rd 1 neg.l erd 1 nop nop 1 not not.b rd 1 not.w rd 1 not.l erd 1
appendix a instruction set rev.7.00 feb. 14, 2007 page 916 of 1108 rej09b0089-0700 instruction fetch branch address read stack operation byte data access word data access internal operation instruction mnemonic i j k l m n or or.b #xx:8,rd 1 or.b rs,rd 1 or.w #xx:16,rd 2 or.w rs,rd 1 or.l #xx:32,erd 3 or.l ers,erd 2 orc orc #xx:8,ccr 1 orc #xx:8,exr 2 pop pop.w rn 1 1 1 pop.l ern 2 2 1 push push.w rn 1 1 1 push.l ern 2 2 1 rotl rotl.b rd 1 rotl.b #2,rd 1 rotl.w rd 1 rotl.w #2,rd 1 rotl.l erd 1 rotl.l #2,erd 1 rotr rotr.b rd 1 rotr.b #2,rd 1 rotr.w rd 1 rotr.w #2,rd 1 rotr.l erd 1 rotr.l #2,erd 1 rotxl rotxl.b rd 1 rotxl.b #2,rd 1 rotxl.w rd 1 rotxl.w #2,rd 1 rotxl.l erd 1 rotxl.l #2,erd 1
appendix a instruction set rev.7.00 feb. 14, 2007 page 917 of 1108 rej09b0089-0700 instruction fetch branch address read stack operation byte data access word data access internal operation instruction mnemonic i j k l m n rotxr rotxr.b rd 1 rotxr.b #2,rd 1 rotxr.w rd 1 rotxr.w #2,rd 1 rotxr.l erd 1 rotxr.l #2,erd 1 rte rte 2 2/3 * 1 1 rts rts 2 2 1 shal shal.b rd 1 shal.b #2,rd 1 shal.w rd 1 shal.w #2,rd 1 shal.l erd 1 shal.l #2,erd 1 shar shar.b rd 1 shar.b #2,rd 1 shar.w rd 1 shar.w #2,rd 1 shar.l erd 1 shar.l #2,erd 1 shll shll.b rd 1 shll.b #2,rd 1 shll.w rd 1 shll.w #2,rd 1 shll.l erd 1 shll.l #2,erd 1 shlr shlr.b rd 1 shlr.b #2,rd 1 shlr.w rd 1 shlr.w #2,rd 1 shlr.l erd 1 shlr.l #2,erd 1 sleep sleep 1 1
appendix a instruction set rev.7.00 feb. 14, 2007 page 918 of 1108 rej09b0089-0700 instruction fetch branch address read stack operation byte data access word data access internal operation instruction mnemonic i j k l m n stc stc.b ccr,rd 1 stc.b exr,rd 1 stc.w ccr,@erd 2 1 stc.w exr,@erd 2 1 stc.w ccr,@(d:16,erd) 3 1 stc.w exr,@(d:16,erd) 3 1 stc.w ccr,@(d:32,erd) 5 1 stc.w exr,@(d:32,erd) 5 1 stc.w ccr,@-erd 2 1 1 stc.w exr,@-erd 2 1 1 stc.w ccr,@aa:16 3 1 stc.w exr,@aa:16 3 1 stc.w ccr,@aa:32 4 1 stc.w exr,@aa:32 4 1 stm stm.l (ern-ern+1), @-sp 2 4 1 stm.l (ern-ern+2), @-sp 2 6 1 stm.l (ern-ern+3), @-sp 2 8 1 stmac stmac mach,erd cannot be used in the chip stmac macl,erd sub sub.b rs,rd 1 sub.w #xx:16,rd 2 sub.w rs,rd 1 sub.l #xx:32,erd 3 sub.l ers,erd 1 subs subs #1/2/4,erd 1 subx subx #xx:8,rd 1 subx rs,rd 1 tas tas @erd * 3 2 2 trapa trapa #x:2 2 2 2/3 * 1 2
appendix a instruction set rev.7.00 feb. 14, 2007 page 919 of 1108 rej09b0089-0700 instruction fetch branch address read stack operation byte data access word data access internal operation instruction mnemonic i j k l m n xor xor.b #xx:8,rd 1 xor.b rs,rd 1 xor.w #xx:16,rd 2 xor.w rs,rd 1 xor.l #xx:32,erd 3 xor.l ers,erd 2 xorc xorc #xx:8,ccr 1 xorc #xx:8,exr 2 notes: 1. the number of state cycles is 2 when exr is invalid, and 3 when exr is valid. 2. when n bytes of data are transferred. 3. only register er0, er1, er4, or er5 should be used when using the tas instruction.
appendix a instruction set rev.7.00 feb. 14, 2007 page 920 of 1108 rej09b0089-0700 a.5 bus states during instruction execution table a.6 indicates the types of cycles that occu r during instruction execution by the cpu. see table a.4 for the number of states per cycle. how to read the table: instruction jmp@aa:24 r:w 2nd internal operation, 1 state r:w ea 1 2345678 end of instruction order of execution read effective address (word-size read) no read or write read 2nd word of current instruction (word-size read) legend: r:b byte-size read r:w word-size read w:b byte-size write w:w word-size write :m transfer of the bus is not performed immediately after this cycle 2nd address of 2nd word (3rd and 4th bytes) 3rd address of 3rd word (5th and 6th bytes) 4th address of 4th word (7th and 8th bytes) 5th address of 5th word (9th and 10th bytes) next address of next instruction ea effective address vec vector address
appendix a instruction set rev.7.00 feb. 14, 2007 page 921 of 1108 rej09b0089-0700 figure a.1 shows timing waveforms for the address bus and the rd , hwr , and lwr signals during execution of the above instruction with an 8-bit bus, using three-state access with no wait states. a ddress bus rd hwr , lwr r:w 2nd fetching 2nd byte of instruction at jump address fetching 1st byte of instruction at jump address fetching 4th byte of instruction fetching 3rd byte of instruction r:w ea high internal operation figure a.1 address bus, rd , hwr , and lwr timing (8-bit bus, three-state access, no wait states)
appendix a instruction set rev.7.00 feb. 14, 2007 page 922 of 1108 rej09b0089-0700 table a.6 instructio n execution cycles instruction add.b #xx:8,rd r:w next add.b rs,rd r:w next add.w #xx:16,rd r:w 2nd r:w next add.w rs,rd r:w next add.l #xx:32,erd r:w 2nd r:w 3rd r:w next add.l ers,erd r:w next adds #1/2/4,erd r:w next addx #xx:8,rd r:w next addx rs,rd r:w next and.b #xx:8,rd r:w next and.b rs,rd r:w next and.w #xx:16,rd r:w 2nd r:w next and.w rs,rd r:w next and.l #xx:32,erd r:w 2nd r:w 3rd r:w next and.l ers,erd r:w 2nd r:w next andc #xx:8,ccr r:w next andc #xx:8,exr r:w 2nd r:w next band #xx:3,rd r:w next band #xx:3,@erd r:w 2nd r:b ea r:w:m next band #xx:3,@aa:8 r:w 2nd r:b ea r:w:m next band #xx:3,@aa:16 r:w 2nd r:w 3rd r:b ea r:w:m next band #xx:3,@aa:32 r:w 2nd r:w 3rd r:w 4th r:b ea r:w:m next bra d:8 (bt d:8) r:w next r:w ea brn d:8 (bf d:8) r:w next r:w ea bhi d:8 r:w next r:w ea bls d:8 r:w next r:w ea bcc d:8 (bhs d:8) r:w next r:w ea bcs d:8 (blo d:8) r:w next r:w ea bne d:8 r:w next r:w ea beq d:8 r:w next r:w ea bvc d:8 r:w next r:w ea bvs d:8 r:w next r:w ea bpl d:8 r:w next r:w ea bmi d:8 r:w next r:w ea bge d:8 r:w next r:w ea blt d:8 r:w next r:w ea bgt d:8 r:w next r:w ea 1 2 3 4 5 6 7 8 9
appendix a instruction set rev.7.00 feb. 14, 2007 page 923 of 1108 rej09b0089-0700 instruction ble d:8 r:w next r:w ea bra d:16 (bt d:16) r:w 2nd internal operation, r:w ea 1 state brn d:16 (bf d:16) r:w 2nd internal operation, r:w ea 1 state bhi d:16 r:w 2nd internal operation, r:w ea 1 state bls d:16 r:w 2nd internal operation, r:w ea 1 state bcc d:16 (bhs d:16) r:w 2nd internal operation, r:w ea 1 state bcs d:16 (blo d:16) r:w 2nd internal operation, r:w ea 1 state bne d:16 r:w 2nd internal operation, r:w ea 1 state beq d:16 r:w 2nd internal operation, r:w ea 1 state bvc d:16 r:w 2nd internal operation, r:w ea 1 state bvs d:16 r:w 2nd internal operation, r:w ea 1 state bpl d:16 r:w 2nd internal operation, r:w ea 1 state bmi d:16 r:w 2nd internal operation, r:w ea 1 state bge d:16 r:w 2nd internal operation, r:w ea 1 state blt d:16 r:w 2nd internal operation, r:w ea 1 state bgt d:16 r:w 2nd internal operation, r:w ea 1 state ble d:16 r:w 2nd internal operation, r:w ea 1 state bclr #xx:3,rd r:w next bclr #xx:3,@erd r:w 2nd r:b:m ea r:w:m next w:b ea bclr #xx:3,@aa:8 r:w 2nd r:b:m ea r:w:m next w:b ea bclr #xx:3,@aa:16 r:w 2nd r:w 3rd r:b:m ea r:w:m next w:b ea 1 2 3 4 5 6 7 8 9
appendix a instruction set rev.7.00 feb. 14, 2007 page 924 of 1108 rej09b0089-0700 instruction bclr #xx:3,@aa:32 r:w 2nd r:w 3rd r:w 4th r:b:m ea r:w:m next w:b ea bclr rn,rd r:w next bclr rn,@erd r:w 2nd r:b:m ea r:w:m next w:b ea bclr rn,@aa:8 r:w 2nd r:b:m ea r:w:m next w:b ea bclr rn,@aa:16 r:w 2nd r:w 3rd r:b:m ea r:w:m next w:b ea bclr rn,@aa:32 r:w 2nd r:w 3rd r:w 4th r:b:m ea r:w:m next w:b ea biand #xx:3,rd r:w next biand #xx:3,@erd r:w 2nd r:b ea r:w:m next biand #xx:3,@aa:8 r:w 2nd r:b ea r:w:m next biand #xx:3,@aa:16 r:w 2nd r:w 3rd r:b ea r:w:m next biand #xx:3,@aa:32 r:w 2nd r:w 3rd r:w 4th r:b ea r:w:m next bild #xx:3,rd r:w next bild #xx:3,@erd r:w 2nd r:b ea r:w:m next bild #xx:3,@aa:8 r:w 2nd r:b ea r:w:m next bild #xx:3,@aa:16 r:w 2nd r:w 3rd r:b ea r:w:m next bild #xx:3,@aa:32 r:w 2nd r:w 3rd r:w 4th r:b ea r:w:m next bior #xx:3,rd r:w next bior #xx:3,@erd r:w 2nd r:b ea r:w:m next bior #xx:3,@aa:8 r:w 2nd r:b ea r:w:m next bior #xx:3,@aa:16 r:w 2nd r:w 3rd r:b ea r:w:m next bior #xx:3,@aa:32 r:w 2nd r:w 3rd r:w 4th r:b ea r:w:m next bist #xx:3,rd r:w next bist #xx:3,@erd r:w 2nd r:b:m ea r:w:m next w:b ea bist #xx:3,@aa:8 r:w 2nd r:b:m ea r:w:m next w:b ea bist #xx:3,@aa:16 r:w 2nd r:w 3rd r:b:m ea r:w:m next w:b ea bist #xx:3,@aa:32 r:w 2nd r:w 3rd r:w 4th r:b:m ea r:w:m next w:b ea bixor #xx:3,rd r:w next bixor #xx:3,@erd r:w 2nd r:b ea r:w:m next bixor #xx:3,@aa:8 r:w 2nd r:b ea r:w:m next bixor #xx:3,@aa:16 r:w 2nd r:w 3rd r:b ea r:w:m next bixor #xx:3,@aa:32 r:w 2nd r:w 3rd r:w 4th r:b ea r:w:m next bld #xx:3,rd r:w next bld #xx:3,@erd r:w 2nd r:b ea r:w:m next bld #xx:3,@aa:8 r:w 2nd r:b ea r:w:m next bld #xx:3,@aa:16 r:w 2nd r:w 3rd r:b ea r:w:m next bld #xx:3,@aa:32 r:w 2nd r:w 3rd r:w 4th r:b ea r:w:m next bnot #xx:3,rd r:w next 1 2 3 4 5 6 7 8 9
appendix a instruction set rev.7.00 feb. 14, 2007 page 925 of 1108 rej09b0089-0700 instruction bnot #xx:3,@erd r:w 2nd r:b:m ea r:w:m next w:b ea bnot #xx:3,@aa:8 r:w 2nd r:b:m ea r:w:m next w:b ea bnot #xx:3,@aa:16 r:w 2nd r:w 3rd r:b:m ea r:w:m next w:b ea bnot #xx:3,@aa:32 r:w 2nd r:w 3rd r:w 4th r:b:m ea r:w:m next w:b ea bnot rn,rd r:w next bnot rn,@erd r:w 2nd r:b:m ea r:w:m next w:b ea bnot rn,@aa:8 r:w 2nd r:b:m ea r:w:m next w:b ea bnot rn,@aa:16 r:w 2nd r:w 3rd r:b:m ea r:w:m next w:b ea bnot rn,@aa:32 r:w 2nd r:w 3rd r:w 4th r:b:m ea r:w:m next w:b ea bor #xx:3,rd r:w next bor #xx:3,@erd r:w 2nd r:b ea r:w:m next bor #xx:3,@aa:8 r:w 2nd r:b ea r:w:m next bor #xx:3,@aa:16 r:w 2nd r:w 3rd r:b ea r:w:m next bor #xx:3,@aa:32 r:w 2nd r:w 3rd r:w 4th r:b ea r:w:m next bset #xx:3,rd r:w next bset #xx:3,@erd r:w 2nd r:b:m ea r:w:m next w:b ea bset #xx:3,@aa:8 r:w 2nd r:b:m ea r:w:m next w:b ea bset #xx:3,@aa:16 r:w 2nd r:w 3rd r:b:m ea r:w:m next w:b ea bset #xx:3,@aa:32 r:w 2nd r:w 3rd r:w 4th r:b:m ea r:w:m next w:b ea bset rn,rd r:w next bset rn,@erd r:w 2nd r:b:m ea r:w:m next w:b ea bset rn,@aa:8 r:w 2nd r:b:m ea r:w:m next w:b ea bset rn,@aa:16 r:w 2nd r:w 3rd r:b:m ea r:w:m next w:b ea bset rn,@aa:32 r:w 2nd r:w 3rd r:w 4th r:b:m ea r:w:m next w:b ea bsr d:8 r:w next r:w ea w:w :m stack (h) w:w stack (l) bsr d:16 r:w 2nd internal operation, r:w ea w:w :m stack (h) w:w stack (l) 1 state bst #xx:3,rd r:w next bst #xx:3,@erd r:w 2nd r:b:m ea r:w:m next w:b ea bst #xx:3,@aa:8 r:w 2nd r:b:m ea r:w:m next w:b ea bst #xx:3,@aa:16 r:w 2nd r:w 3rd r:b:m ea r:w:m next w:b ea bst #xx:3,@aa:32 r:w 2nd r:w 3rd r:w 4th r:b:m ea r:w:m next w:b ea btst #xx:3,rd r:w next btst #xx:3,@erd r:w 2nd r:b ea r:w:m next 1 2 3 4 5 6 7 8 9
appendix a instruction set rev.7.00 feb. 14, 2007 page 926 of 1108 rej09b0089-0700 instruction 1 2 3 4 5 6 7 8 9 btst #xx:3,@aa:8 r:w 2nd r:b ea r:w:m next btst #xx:3,@aa:16 r:w 2nd r:w 3rd r:b ea r:w:m next btst #xx:3,@aa:32 r:w 2nd r:w 3rd r:w 4th r:b ea r:w:m next btst rn,rd r:w next btst rn,@erd r:w 2nd r:b ea r:w:m next btst rn,@aa:8 r:w 2nd r:b ea r:w:m next btst rn,@aa:16 r:w 2nd r:w 3rd r:b ea r:w:m next btst rn,@aa:32 r:w 2nd r:w 3rd r:w 4th r:b ea r:w:m next bxor #xx:3,rd r:w next bxor #xx:3,@erd r:w 2nd r:b ea r:w:m next bxor #xx:3,@aa:8 r:w 2nd r:b ea r:w:m next bxor #xx:3,@aa:16 r:w 2nd r:w 3rd r:b ea r:w:m next bxor #xx:3,@aa:32 r:w 2nd r:w 3rd r:w 4th r:b ea r:w:m next clrmac cannot be used in the chip cmp.b #xx:8,rd r:w next cmp.b rs,rd r:w next cmp.w #xx:16,rd r:w 2nd r:w next cmp.w rs,rd r:w next cmp.l #xx:32,erd r:w 2nd r:w 3rd r:w next cmp.l ers,erd r:w next daa rd r:w next das rd r:w next dec.b rd r:w next dec.w #1/2,rd r:w next dec.l #1/2,erd r:w next divxs.b rs,rd r:w 2nd r:w next internal operation, 11 states divxs.w rs,erd r:w 2nd r:w next internal operation, 19 states divxu.b rs,rd r:w next internal operation, 11 states divxu.w rs,erd r:w next internal operation, 19 states eepmov.b r:w 2nd r:b eas * 1 r:b ead * 1 r:b eas * 2 w:b ead * 2 r:w next eepmov.w r:w 2nd r:b eas * 1 r:b ead * 1 r:b eas * 2 w:b ead * 2 r:w next exts.w rd r:w next repeated n times * 2 exts.l erd r:w next extu.w rd r:w next extu.l erd r:w next inc.b rd r:w next
appendix a instruction set rev.7.00 feb. 14, 2007 page 927 of 1108 rej09b0089-0700 instruction inc.w #1/2,rd r:w next inc.l #1/2,erd r:w next jmp @ern r:w next r:w ea jmp @aa:24 r:w 2nd internal operation, r:w ea 1 state jmp @@aa:8 r:w next r:w:m aa:8 r:w aa:8 internal operation, r:w ea 1 state jsr @ern r:w next r:w ea w:w :m stack (h) w:w stack (l) jsr @aa:24 r:w 2nd internal operation, r:w ea w:w :m stack (h) w:w stack (l) 1 state jsr @@aa:8 r:w next r:w:m aa:8 r:w aa:8 w:w :m stack (h) w:w stack (l) r:w ea ldc #xx:8,ccr r:w next ldc #xx:8,exr r:w 2nd r:w next ldc rs,ccr r:w next ldc rs,exr r:w next ldc @ers,ccr r:w 2nd r:w next r:w ea ldc @ers,exr r:w 2nd r:w next r:w ea ldc @(d:16,ers),ccr r:w 2nd r:w 3rd r:w next r:w ea ldc @(d:16,ers),exr r:w 2nd r:w 3rd r:w next r:w ea ldc @(d:32,ers),ccr r:w 2nd r:w 3rd r:w 4th r:w 5th r:w next r:w ea ldc @(d:32,ers),exr r:w 2nd r:w 3rd r:w 4th r:w 5th r:w next r:w ea ldc @ers+,ccr r:w 2nd r:w next internal operation, r:w ea 1 state ldc @ers+,exr r:w 2nd r:w next internal operation, r:w ea 1 state ldc @aa:16,ccr r:w 2nd r:w 3rd r:w next r:w ea ldc @aa:16,exr r:w 2nd r:w 3rd r:w next r:w ea ldc @aa:32,ccr r:w 2nd r:w 3rd r:w 4th r:w next r:w ea ldc @aa:32,exr r:w 2nd r:w 3rd r:w 4th r:w next r:w ea ldm.l @sp+, r:w 2nd r:w:m next internal operation, r:w:m stack (h) * 3 r:w stack (l) * 3 (ern ? ern+1) 1 state 1 2 3 4 5 6 7 8 9
appendix a instruction set rev.7.00 feb. 14, 2007 page 928 of 1108 rej09b0089-0700 instruction ldm.l @sp+,(ern ? ern+2) r:w 2nd r:w next internal operation, r:w:m stack (h) * 3 r:w stack (l) * 3 1 state ldm.l @sp+,(ern ? ern+3) r:w 2nd r:w next internal operation, r:w:m stack (h) * 3 r:w stack (l) * 3 1 state ldmac ers,mach cannot be used in the chip ldmac ers,macl mac @ern+,@erm+ mov.b #xx:8,rd r:w next mov.b rs,rd r:w next mov.b @ers,rd r:w next r:b ea mov.b @(d:16,ers),rd r:w 2nd r:w next r:b ea mov.b @(d:32,ers),rd r:w 2nd r:w 3rd r:w 4th r:w next r:b ea mov.b @ers+,rd r:w next internal operation, r:b ea 1 state mov.b @aa:8,rd r:w next r:b ea mov.b @aa:16,rd r:w 2nd r:w next r:b ea mov.b @aa:32,rd r:w 2nd r:w 3rd r:w next r:b ea mov.b rs,@erd r:w next w:b ea mov.b rs,@(d:16,erd) r:w 2nd r:w next w:b ea mov.b rs,@(d:32,erd) r:w 2nd r:w 3rd r:w 4th r:w next w:b ea mov.b rs,@ ? erd r:w next internal operation, w:b ea 1 state mov.b rs,@aa:8 r:w next w:b ea mov.b rs,@aa:16 r:w 2nd r:w next w:b ea mov.b rs,@aa:32 r:w 2nd r:w 3rd r:w next w:b ea mov.w #xx:16,rd r:w 2nd r:w next mov.w rs,rd r:w next mov.w @ers,rd r:w next r:w ea mov.w @(d:16,ers),rd r:w 2nd r:w next r:w ea mov.w @(d:32,ers),rd r:w 2nd r:w 3rd r:w 4th r:w next r:w ea mov.w @ers+, rd r:w next internal operation, r:w ea 1 state mov.w @aa:16,rd r:w 2nd r:w next r:w ea mov.w @aa:32,rd r:w 2nd r:w 3rd r:w next r:b ea mov.w rs,@erd r:w next w:w ea 1 2 3 4 5 6 7 8 9
appendix a instruction set rev.7.00 feb. 14, 2007 page 929 of 1108 rej09b0089-0700 instruction 1 2 3 4 5 6 7 8 9 mov.w rs,@(d:16,erd) r:w 2nd r:w next w:w ea mov.w rs,@(d:32,erd) r:w 2nd r:w 3rd r:e 4th r:w next w:w ea mov.w rs,@ ? erd r:w next internal operation, w:w ea 1 state mov.w rs,@aa:16 r:w 2nd r:w next w:w ea mov.w rs,@aa:32 r:w 2nd r:w 3rd r:w next w:w ea mov.l #xx:32,erd r:w 2nd r:w 3rd r:w next mov.l ers,erd r:w next mov.l @ers,erd r:w 2nd r:w:m next r:w:m ea r:w ea+2 mov.l @(d:16,ers),erd r:w 2nd r:w:m 3rd r:w next r:w:m ea r:w ea+2 mov.l @(d:32,ers),erd r:w 2nd r:w:m 3rd r:w:m 4th r:w 5th r:w next r:w:m ea r:w ea+2 mov.l @ers+,erd r:w 2nd r:w:m next internal operation, r:w:m ea r:w ea+2 1 state mov.l @aa:16,erd r:w 2nd r:w:m 3rd r:w next r:w:m ea r:w ea+2 mov.l @aa:32,erd r:w 2nd r:w:m 3rd r:w 4th r:w next r:w:m ea r:w ea+2 mov.l ers,@erd r:w 2nd r:w:m next w:w:m ea w:w ea+2 mov.l ers,@(d:16,erd) r:w 2nd r:w:m 3rd r:w next w:w:m ea w:w ea+2 mov.l ers,@(d:32,erd) r:w 2nd r:w:m 3rd r:w:m 4th r:w 5th r:w next w:w:m ea w:w ea+2 mov.l ers,@ ? erd r:w 2nd r:w:m next internal operation, w:w:m ea w:w ea+2 1 state mov.l ers,@aa:16 r:w 2nd r:w:m 3rd r:w next w:w:m ea w:w ea+2 mov.l ers,@aa:32 r:w 2nd r:w:m 3rd r:w 4th r:w next w:w:m ea w:w ea+2 movfpe @aa:16,rd cannot be used in the chip movtpe rs,@aa:16 mulxs.b rs,rd r:w 2nd r:w next internal operation, 11 states mulxs.w rs,erd r:w 2nd r:w next internal operation, 19 states mulxu.b rs,rd r:w next internal operation, 11 states mulxu.w rs,erd r:w next internal operation, 19 states neg.b rd r:w next neg.w rd r:w next neg.l erd r:w next nop r:w next not.b rd r:w next not.w rd r:w next not.l erd r:w next or.b #xx:8,rd r:w next or.b rs,rd r:w next
appendix a instruction set rev.7.00 feb. 14, 2007 page 930 of 1108 rej09b0089-0700 instruction or.w #xx:16,rd r:w 2nd r:w next or.w rs,rd r:w next or.l #xx:32,erd r:w 2nd r:w 3rd r:w next or.l ers,erd r:w 2nd r:w next orc #xx:8,ccr r:w next orc #xx:8,exr r:w 2nd r:w next pop.w rn r:w next internal operation, r:w ea 1 state pop.l ern r:w 2nd r:w:m next internal operation, r:w:m ea r:w ea+2 1 state push.w rn r:w next internal operation, w:w ea 1 state push.l ern r:w 2nd r:w:m next internal operation, w:w:m ea w:w ea+2 1 state rotl.b rd r:w next rotl.b #2,rd r:w next rotl.w rd r:w next rotl.w #2,rd r:w next rotl.l erd r:w next rotl.l #2,erd r:w next rotr.b rd r:w next rotr.b #2,rd r:w next rotr.w rd r:w next rotr.w #2,rd r:w next rotr.l erd r:w next rotr.l #2,erd r:w next rotxl.b rd r:w next rotxl.b #2,rd r:w next rotxl.w rd r:w next rotxl.w #2,rd r:w next rotxl.l erd r:w next rotxl.l #2,erd r:w next rotxr.b rd r:w next rotxr.b #2,rd r:w next rotxr.w rd r:w next rotxr.w #2,rd r:w next rotxr.l erd r:w next 1 2 3 4 5 6 7 8 9
appendix a instruction set rev.7.00 feb. 14, 2007 page 931 of 1108 rej09b0089-0700 instruction rotxr.l #2,erd r:w next rte r:w next r:w stack (exr) r:w stack (h) r:w stack (l) internal operation, r:w * 4 1 state rts r:w next r:w:m stack (h) r:w stack (l) internal operation, r:w * 4 1 state shal.b rd r:w next shal.b #2,rd r:w next shal.w rd r:w next shal.w #2,rd r:w next shal.l erd r:w next shal.l #2,erd r:w next shar.b rd r:w next shar.b #2,rd r:w next shar.w rd r:w next shar.w #2,rd r:w next shar.l erd r:w next shar.l #2,erd r:w next shll.b rd r:w next shll.b #2,rd r:w next shll.w rd r:w next shll.w #2,rd r:w next shll.l erd r:w next shll.l #2,erd r:w next shlr.b rd r:w next shlr.b #2,rd r:w next shlr.w rd r:w next shlr.w #2,rd r:w next shlr.l erd r:w next shlr.l #2,erd r:w next sleep r:w next internal operation:m stc ccr,rd r:w next stc exr,rd r:w next stc ccr,@erd r:w 2nd r:w next w:w ea stc exr,@erd r:w 2nd r:w next w:w ea stc ccr,@(d:16,erd) r:w 2nd r:w 3rd r:w next w:w ea 1 2 3 4 5 6 7 8 9
appendix a instruction set rev.7.00 feb. 14, 2007 page 932 of 1108 rej09b0089-0700 instruction stc exr,@(d:16,erd) r:w 2nd r:w 3rd r:w next w:w ea stc ccr,@(d:32,erd) r:w 2nd r:w 3rd r:w 4th r:w 5th r:w next w:w ea stc exr,@(d:32,erd) r:w 2nd r:w 3rd r:w 4th r:w 5th r:w next w:w ea stc ccr,@ ? erd r:w 2nd r:w next internal operation, w:w ea 1 state stc exr,@ ? erd r:w 2nd r:w next internal operation, w:w ea 1 state stc ccr,@aa:16 r:w 2nd r:w 3rd r:w next w:w ea stc exr,@aa:16 r:w 2nd r:w 3rd r:w next w:w ea stc ccr,@aa:32 r:w 2nd r:w 3rd r:w 4th r:w next w:w ea stc exr,@aa:32 r:w 2nd r:w 3rd r:w 4th r:w next w:w ea stm.l(ern ? ern+1),@ ? sp r:w 2nd r:w:m next internal operation, w:w:m stack (h) * 3 w:w stack (l) * 3 1 state stm.l(ern ? ern+2),@ ? sp r:w 2nd r:w:m next internal operation, w:w:m stack (h) * 3 w:w stack (l) * 3 1 state stm.l(ern ? ern+3),@ ? sp r:w 2nd r:w:m next internal operation, w:w:m stack (h) * 3 w:w stack (l) * 3 1 state stmac mach,erd cannot be used in the chip stmac macl,erd sub.b rs,rd r:w next sub.w #xx:16,rd r:w 2nd r:w next sub.w rs,rd r:w next sub.l #xx:32,erd r:w 2nd r:w 3rd r:w next sub.l ers,erd r:w next subs #1/2/4,erd r:w next subx #xx:8,rd r:w next subx rs,rd r:w next tas @erd * 8 r:w 2nd r:w next r:b:m ea w:b ea trapa #x:2 r:w next internal operation, w:w stack (l) w:w stack (h) w:w stack (exr) r:w:m vec r:w vec+2 internal operation, r:w * 7 1 state 1 state xor.b #xx8,rd r:w next xor.b rs,rd r:w next xor.w #xx:16,rd r:w 2nd r:w next xor.w rs,rd r:w next xor.l #xx:32,erd r:w 2nd r:w 3rd r:w next 1 2 3 4 5 6 7 8 9
appendix a instruction set rev.7.00 feb. 14, 2007 page 933 of 1108 rej09b0089-0700 instruction xor.l ers,erd r:w 2nd r:w next xorc #xx:8,ccr r:w next xorc #xx:8,exr r:w 2nd r:w next reset exception r:w vec r:w vec+2 internal operation, r:w * 5 handling 1 state interrupt exception r:w * 6 internal operation, w:w stack (l) w:w stack (h) w:w stack (exr) r:w:m vec r:w vec+2 internal operation, r:w * 7 handling 1 state 1 state notes: 1. eas is the contents of er5. ead is the contents of er6. 2. eas is the contents of er5. ead is the contents of er6. both registers are incremented by 1 after execution of the instruct ion. n is the initial value of r4l or r4. if n = 0, these bus cycles are not executed. 3. repeated two times to save or restore two registers, three times for three registers, or four times for four registers. 4. start address after return. 5. start address of the program. 6. prefetch address, equal to two plus the pc value pushed onto the stack. in recovery from sleep mode or software standby mod e the read operation is replaced by an internal operation. 7. start address of the interrupt handling routine. 8. only register er0, er1, er4, or er5 should be used when using the tas instruction. 1 2 3 4 5 6 7 8 9
appendix a instruction set rev.7.00 feb. 14, 2007 page 934 of 1108 rej09b0089-0700 a.6 condition code modification this section indicates the effect of each cpu instruction on the condition code. the notation used in the table is defined below. m = 31 for longword operands 15 for word operands 7 for byte operands si di ri dn ? 0 1 * z' c' the i-th bit of the source operand the i-th bit of the destination operand the i-th bit of the result the specified bit in the destination operand not affected modified according to the result of the instruction (see definition) always cleared to 0 always set to 1 undetermined (no guaranteed value) z flag before instruction execution c flag before instruction execution
appendix a instruction set rev.7.00 feb. 14, 2007 page 935 of 1108 rej09b0089-0700 table a.7 condition code modification instruction h n z v c definition add h = sm?4 dm?4 + dm?4 rm?4 + sm?4 rm?4 n = rm z = rm rm?1 ...... r0 v = sm dm rm + sm dm rm c = sm dm + dm rm + sm rm adds ? ? ? ? ? addx h = sm?4 dm?4 + dm?4 rm?4 + sm?4 rm?4 n = rm z = z' rm ...... r0 v = sm dm rm + sm dm rm c = sm dm + dm rm + sm rm and ? 0 ? n = rm z = rm rm?1 ...... r0 andc stores the corresponding bits of the result. no flags change when the operand is exr. band ? ? ? ? c = c' dn bcc ? ? ? ? ? bclr ? ? ? ? ? biand ? ? ? ? c = c' dn bild ? ? ? ? c = dn bior ? ? ? ? c = c' + dn bist ? ? ? ? ? bixor ? ? ? ? c = c' dn + c' dn bld ? ? ? ? c = dn bnot ? ? ? ? ? bor ? ? ? ? c = c' + dn bset ? ? ? ? ? bsr ? ? ? ? ? bst ? ? ? ? ? btst ? ? ? ? z = dn bxor ? ? ? ? c = c' dn + c' dn clrmac cannot be used in the chip
appendix a instruction set rev.7.00 feb. 14, 2007 page 936 of 1108 rej09b0089-0700 instruction h n z v c definition cmp h = sm?4 dm?4 + dm?4 rm?4 + sm?4 rm?4 n = rm z = rm rm?1 ...... r0 v = sm dm rm + sm dm rm c = sm dm + dm rm + sm rm daa * * n = rm z = rm rm?1 ...... r0 c: decimal arithmetic carry das * * n = rm z = rm rm?1 ...... r0 c: decimal arithmetic borrow dec ? ? n = rm z = rm rm?1 ...... r0 v = dm rm divxs ? ? ? n = sm dm + sm dm z = sm sm?1 ...... s0 divxu ? ? ? n = sm z = sm sm?1 ...... s0 eepmov ? ? ? ? ? exts ? 0 ? n = rm z = rm rm?1 ...... r0 extu ? 0 0 ? z = rm rm?1 ...... r0 inc ? ? n = rm z = rm rm?1 ...... r0 v = dm rm jmp ? ? ? ? ? jsr ? ? ? ? ? ldc stores the corresponding bits of the result. no flags change when the operand is exr. ldm ? ? ? ? ? ldmac cannot be used in the chip mac
appendix a instruction set rev.7.00 feb. 14, 2007 page 937 of 1108 rej09b0089-0700 instruction h n z v c definition mov ? 0 ? n = rm z = rm rm?1 ...... r0 movfpe cannot be used in the chip movtpe mulxs ? ? ? n = r2m z = r2m r2m?1 ...... r0 mulxu ? ? ? ? ? neg h = dm?4 + rm?4 n = rm z = rm rm?1 ...... r0 v = dm rm c = dm + rm nop ? ? ? ? ? not ? 0 ? n = rm z = rm rm?1 ...... r0 or ? 0 ? n = rm z = rm rm?1 ...... r0 orc stores the corresponding bits of the result. no flags change when the operand is exr. pop ? 0 ? n = rm z = rm rm?1 ...... r0 push ? 0 ? n = rm z = rm rm?1 ...... r0 rotl ? 0 n = rm z = rm rm?1 ...... r0 c = dm (1-bit shift) or c = dm?1 (2-bit shift) rotr ? 0 n = rm z = rm rm?1 ...... r0 c = d0 (1-bit shift) or c = d1 (2-bit shift)
appendix a instruction set rev.7.00 feb. 14, 2007 page 938 of 1108 rej09b0089-0700 instruction h n z v c definition rotxl ? 0 n = rm z = rm rm?1 ...... r0 c = dm (1-bit shift) or c = dm?1 (2-bit shift) rotxr ? 0 n = rm z = rm rm?1 ...... r0 c = d0 (1-bit shift) or c = d1 (2-bit shift) rte stores the corresponding bits of the result. rts ? ? ? ? ? shal ? n = rm z = rm rm?1 ...... r0 v = dm dm?1 + dm dm?1 (1-bit shift) v = dm dm?1 dm?2 dm dm?1 dm?2 (2-bit shift) c = dm (1-bit shift) or c = dm?1 (2-bit shift) shar ? 0 n = rm z = rm rm?1 ...... r0 c = d0 (1-bit shift) or c = d1 (2-bit shift) shll ? 0 n = rm z = rm rm?1 ...... r0 c = dm (1-bit shift) or c = dm?1 (2-bit shift) shlr ? 0 0 n = rm z = rm rm?1 ...... r0 c = d0 (1-bit shift) or c = d1 (2-bit shift) sleep ? ? ? ? ? stc ? ? ? ? ? stm ? ? ? ? ? stmac cannot be used in the chip
appendix a instruction set rev.7.00 feb. 14, 2007 page 939 of 1108 rej09b0089-0700 instruction h n z v c definition sub h = sm?4 dm?4 + dm?4 rm?4 + sm?4 rm?4 n = rm z = rm rm?1 ...... r0 v = sm dm rm + sm dm rm c = sm dm + dm rm + sm rm subs ? ? ? ? ? subx h = sm?4 dm?4 + dm?4 rm?4 + sm?4 rm?4 n = rm z = z' rm ...... r0 v = sm dm rm + sm dm rm c = sm dm + dm rm + sm rm tas ? 0 ? n = dm z = dm dm?1 ...... d0 trapa ? ? ? ? ? xor ? 0 ? n = rm z = rm rm?1 ...... r0 xorc stores the corresponding bits of the result. no flags change when the operand is exr.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 940 of 1108 rej09b0089-0700 appendix b internal i/o registers b.1 list of registers (address order) address register name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name data bus width h'f800 mra sm1 sm0 dm1 dm0 md1 md0 dts sz dtc to sar 16/32 * 1 bits h'fbff mrb chne disel chns ? ? ? ? ? dar cra crb h'fe80 tcr3 cclr2 cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 tpu3 16 bits h'fe81 tmdr3 ? ? bfb bfa md3 md2 md1 md0 h'fe82 tior3h iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 h'fe83 tior3l iod3 iod2 iod1 iod0 ioc3 ioc2 ioc1 ioc0 h'fe84 tier3 ttge ? ? tciev tgied tgiec tgieb tgiea h'fe85 tsr3 ? ? ? tcfv tgfd tgfc tgfb tgfa h'fe86 tcnt3 h'fe87 h'fe88 tgr3a h'fe89 h'fe8a tgr3b h'fe8b h'fe8c tgr3c h'fe8d h'fe8e tgr3d h'fe8f
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 941 of 1108 rej09b0089-0700 address register name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name data bus width h'fe90 tcr4 ? cclr1 cclr0 ckeg ckeg0 tpsc2 tpsc1 tpsc0 tpu4 16 bits h'fe91 tmdr4 ? ? ? ? md3 md2 md1 md0 h'fe92 tior4 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 h'fe94 tier4 ttge ? tcieu tciev ? ? tgieb tgiea h'fe95 tsr4 tcfd ? tcfu tcfv ? ? tgfb tgfa h'fe96 tcnt4 h'fe97 h'fe98 tgr4a h'fe99 h'fe9a tgr4b h'fe9b h'fea0 tcr5 ? cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 tpu5 16 bits h'fea1 tmdr5 ? ? ? ? md3 md2 md1 md0 h'fea2 tior5 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 h'fea4 tier5 ttge ? tcieu tciev ? ? tgieb tgiea h'fea5 tsr5 tcfd ? tcfu tcfv ? ? tgfb tgfa h'fea6 tcnt5 h'fea7 h'fea8 tgr5a h'fea9 h'feaa tgr5b h'feab h'feb0 p1ddr p17ddr p16ddr p15ddr p14ddr p 13ddr p12ddr p11ddr p10ddr ports 8 bits h'feb1 p2ddr p27ddr p26ddr p25ddr p 24ddr p23ddr p22ddr p21ddr p20ddr h'feb2 p3ddr ? ? p35ddr p34ddr p33ddr p32ddr p31ddr p30ddr h'feb9 paddr ? ? ? ? pa3ddr pa2ddr pa1ddr pa0ddr h'feba pbddr pb7ddr pb6ddr pb5ddr pb4ddr pb3ddr pb2ddr pb1ddr pb0ddr h'febb pcddr pc7ddr pc6ddr pc5ddr pc4ddr pc3ddr pc2ddr pc1ddr pc0ddr h'febc pdddr pd7ddr pd6ddr pd5ddr pd4ddr pd3ddr pd2ddr pd1ddr pd0ddr h'febd peddr pe7ddr pe6ddr pe5ddr pe4ddr pe3ddr pe2ddr pe1ddr pe0ddr h'febe pfddr pf7ddr pf6ddr pf5ddr pf4ddr pf3ddr pf2ddr pf1ddr pf0ddr h'febf pgddr ? ? ? pg4ddr pg 3ddr pg2ddr pg1ddr pg0ddr
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 942 of 1108 rej09b0089-0700 address register name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name data bus width h'fec4 ipra ? ipr6 ipr5 ipr4 ? ipr2 ipr1 ipr0 8 bits h'fec5 iprb ? ipr6 ipr5 ipr4 ? ipr2 ipr1 ipr0 interrupt controller h'fec6 iprc ? ipr6 ipr5 ipr4 ? ipr2 ipr1 ipr0 h'fec7 iprd ? ipr6 ipr5 ipr4 ? ? ? ? h'fec8 ipre ? ? ? ? ? ipr2 ipr1 ipr0 h'fec9 iprf ? ipr6 ipr5 ipr4 ? ipr2 ipr1 ipr0 h'feca iprg ? ipr6 ipr5 ipr4 ? ipr2 ipr1 ipr0 h'fecb iprh ? ipr6 ipr5 ipr4 ? ipr2 ipr1 ipr0 h'fecc ipri ? ipr6 ipr5 ipr4 ? ipr2 ipr1 ipr0 h'fecd iprj ? ? ? ? ? ipr2 ipr1 ipr0 h'fece iprk ? ipr6 ipr5 ipr4 ? ? ? ? h'fed0 abwcr abw7 abw6 abw5 abw4 abw3 abw2 abw1 abw0 8 bits h'fed1 astcr ast7 ast6 ast 5 ast4 ast3 ast2 ast1 ast0 bus controller h'fed2 wcrh w71 w70 w61 w60 w51 w50 w41 w40 h'fed3 wcrl w31 w30 w21 w20 w11 w10 w01 w00 h'fed4 bcrh icis1 icis0 brstrm brsts1 brsts0 ? ? ? h'fed5 bcrl brle breqoe eae ? ? ? ? waite h'fedb ramer * 2 ? ? ? ? rams ram2 ram1 ram0 flash memory 8 bits h'ff2c iscrh irq7scb irq7sca irq6scb irq6sca irq5scb irq5sca irq4scb irq4sca 8 bits h'ff2d iscrl irq3scb irq3sca irq2scb irq2sca irq1scb irq1sca irq0scb irq0sca interrupt controller h'ff2e ier irq7e irq6e irq5e irq4e irq3e irq2e irq1e irq0e h'ff2f isr irq7f irq6f irq5f irq4f irq3f irq2f irq1f irq0f h'ff30 to h'ff34 dtcer dtce7 dtce6 dtce5 dtce4 dtce 3 dtce2 dtce1 dtce0 dtc 8 bits h'ff37 dtvecr swdte dtvec6 dtvec5 dt vec4 dtvec3 dtvec2 dtvec1 dtvec0 h'ff38 sbycr ssby sts2 sts1 sts0 ope ? ? irq37s power-down mode 8 bits h'ff39 syscr ? ? intm1 intm0 nmieg lwrod ? rame mcu 8 bits h'ff3a sckcr pstop ? div ? ? sck2 sck1 sck0 clock pulse generator 8 bits h'ff3b mdcr ? ? ? ? ? mds2 mds1 mds0 mcu 8 bits h'ff3c mstpcrh mstp15 mstp14 mstp13 mstp12 mstp11 mstp10 mstp9 mstp8 8 bits h'ff3d mstpcrl mstp7 mstp6 mstp5 mstp4 mstp3 mstp2 mstp1 mstp0 power- down mode
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 943 of 1108 rej09b0089-0700 address register name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name data bus width h'ff42 syscr2 * 3 ? ? ? ? flshe ? ? ? flash memory 8 bits h'ff44 reserved ? ? ? ? ? ? ? ? reserved ? h'ff45 pfcr1 css17 css36 pf1cs5s pf0cs4s a23e a22e a21e a20e ports 8 bits h'ff50 port1 p17 p16 p15 p14 p13 p12 p11 p10 h'ff51 port2 p27 p26 p25 p24 p23 p22 p21 p20 h'ff52 port3 ? ? p35 p34 p33 p32 p31 p30 h'ff53 port4 p47 p46 p45 p44 p43 p42 p41 p40 h'ff59 porta ? ? ? ? pa3 pa2 pa1 pa0 h'ff5a portb pb7 pb6 pb5 pb4 pb3 pb2 pb1 pb0 h'ff5b portc pc7 pc6 pc5 pc4 pc3 pc2 pc1 pc0 h'ff5c portd pd7 pd6 pd5 pd4 pd3 pd2 pd1 pd0 h'ff5d porte pe7 pe6 pe5 pe4 pe3 pe2 pe1 pe0 h'ff5e portf pf7 pf6 pf5 pf4 pf3 pf2 pf1 pf0 h'ff5f portg ? ? ? pg4 pg3 pg2 pg1 pg0 h'ff60 p1dr p17dr p16dr p15dr p14 dr p13dr p12dr p11dr p10dr h'ff61 p2dr p27dr p26dr p25dr p24 dr p23dr p22dr p21dr p20dr h'ff62 p3dr ? ? p35dr p34dr p33dr p32dr p31dr p30dr h'ff69 padr ? ? ? ? pa3dr pa2dr pa1dr pa0dr h'ff6a pbdr pb7dr pb6dr pb5dr pb4dr pb3dr pb2dr pb1dr pb0dr h'ff6b pcdr pc7dr pc6dr pc5dr pc4dr pc3dr pc2dr pc1dr pc0dr h'ff6c pddr pd7dr pd6dr pd5dr pd4dr pd3dr pd2dr pd1dr pd0dr h'ff6d pedr pe7dr pe6dr pe5dr pe4dr pe3dr pe2dr pe1dr pe0dr h'ff6e pfdr pf7dr pf6dr pf5dr pf4dr pf3dr pf2dr pf1dr pf0dr h'ff6f pgdr ? ? ? pg4dr pg 3dr pg2dr pg1dr pg0dr h'ff70 papcr ? ? ? ? pa3pcr pa2pcr pa1pcr pa0pcr h'ff71 pbpcr pb7pcr pb6pcr pb5pcr pb4pcr pb3pcr pb2pcr pb1pcr pb0pcr h'ff72 pcpcr pc7pcr pc6pcr pc5pcr pc4pcr pc3pcr pc2pcr pc1pcr pc0pcr h'ff73 pdpcr pd7pcr pd6pcr pd5pcr pd4pcr pd3pcr pd2pcr pd1pcr pd0pcr h'ff74 pepcr pe7pcr pe6pcr pe5pcr pe4pcr pe3pcr pe2pcr pe1pcr pe0pcr h'ff76 p3odr ? ? p35odr p34odr p33odr p32odr p31odr p30odr h'ff77 paodr ? ? ? ? pa3odr pa2odr pa1odr pa0odr
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 944 of 1108 rej09b0089-0700 address register name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name data bus width h'ff78 smr0 c/ a / gm * 3 chr/ blk * 4 pe o/ e stop/ bcp1 * 5 mp/ bcp0 * 6 cks1 cks0 8 bits h'ff79 brr0 h'ff7a scr0 tie rie te re mpie teie cke1 cke0 sci0, smart card interface 0 h'ff7b tdr0 h'ff7c ssr0 tdre rdrf orer fer/ ers * 7 per tend mpb mpbt h'ff7d rdr0 h'ff7e scmr0 ? ? ? ? sdir sinv ? smif h'ff80 smr1 c/ a / gm * 4 chr/ blk * 5 pe o/ e stop/ bcp1 * 6 mp/ bcp0 * 7 cks1 cks0 8 bits h'ff81 brr1 h'ff82 scr1 tie rie te re mpie teie cke1 cke0 sci1, smart card interface 1 h'ff83 tdr1 h'ff84 ssr1 tdre rdrf orer fer/ ers * 8 per tend mpb mpbt h'ff85 rdr1 h'ff86 scmr1 ? ? ? ? sdir sinv ? smif h'fe90 addrah ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 a/d converter 8 bits h'fe91 addral ad1 ad0 ? ? ? ? ? ? h'fe92 addrbh ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'fe93 addrbl ad1 ad0 ? ? ? ? ? ? h'fe94 addrch ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'fe95 addrcl ad1 ad0 ? ? ? ? ? ? h'fe96 addrdh ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'fe97 addrdl ad1 ad0 ? ? ? ? ? ? h'fe98 adcsr adf adie adst scan cks ch2 ch1 ch0 h'fe99 adcr trgs1 trgs0 ? ? cks1 ? ? ?
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 945 of 1108 rej09b0089-0700 address register name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name data bus width h'ffa4 dadr0 8 bits h'ffa5 dadr1 h'ffa6 dacr01 daoe1 daoe0 dae ? ? ? ? ? d/a converter h'ffac pfcr2 ? ? cs167e cs25e asod ? ? ? ports 8 bits h'ffb0 tcr0 cmieb cmiea ovie cclr1 cclr0 cks2 cks1 cks0 16 bits h'ffb1 tcr1 cmieb cmiea ovie cclr1 cclr0 cks2 cks1 cks0 h'ffb2 tcsr0 cmfb cmfa ovf adte os3 os2 os1 os0 8-bit timer channel 0, 1 h'ffb3 tcsr1 cmfb cmfa ovf ? os3 os2 os1 os0 h'ffb4 tcora0 h'ffb5 tcora1 h'ffb6 tcorb0 h'ffb7 tcorb1 h'ffb8 tcnt0 h'ffb9 tcnt1 h'ffbc (read) tcsr ovf wt/ it tme ? ? cks2 cks1 cks0 wdt 16 bits h'ffbd (read) tcnt h'ffbf (read) rstcsr wovf rste ? ? ? ? ? ? h'ffc0 tstr ? ? cst5 cst4 cst3 cst2 cst1 cst0 tpu 16 bits h'ffc1 tsyr ? ? sync5 sync4 sync3 sync2 sync1 sync0
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 946 of 1108 rej09b0089-0700 address register name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name data bus width h'ffc8 * 9 flmcr1 fwe swe esu psu ev pv e p 8 bits h'ffc9 * 9 flmcr2 fler ? ? ? ? ? ? ? h'ffca * 9 ebr1 eb7 eb6 eb5 eb4 eb3 eb2 eb1 eb0 h'ffcb * 9 ebr2 ? ? ? ? ? ? eb9 eb8 flash memory (h8s/2317 f-ztat) h'ffc8 * 10 flmcr1 fwe swe esu psu ev pv e p 8 bits h'ffc9 * 10 flmcr2 fler ? ? ? ? ? ? ? h'ffca * 10 ebr1 eb7 eb6 eb5 eb4 eb3 eb2 eb1 eb0 h'ffcb * 10 ebr2 ? ? ? ? eb11 eb10 eb9 eb8 flash memory (h8s/2318 f-ztat) h'ffc8 * 11 flmcr1 fwe swe esu psu ev pv e p 8 bits h'ffc9 * 11 flmcr2 fler ? ? ? ? ? ? ? h'ffca * 11 ebr1 eb7 eb6 eb5 eb4 eb3 eb2 eb1 eb0 h'ffcb * 11 ebr2 ? ? eb13 eb12 eb11 eb10 eb9 eb8 flash memory (h8s/2315 f-ztat, h8s/2314 f-ztat) h'ffc8 * 12 flmcr1 fwe swe1 esu1 psu1 ev1 pv1 e1 p1 8 bits h'ffc9 * 12 flmcr2 fler swe2 esu2 psu2 ev2 pv2 e2 p2 h'ffca * 12 ebr1 eb7 eb6 eb5 eb4 eb3 eb2 eb1 eb0 h'ffcb * 12 ebr2 eb15 eb14 eb13 eb12 eb11 eb10 eb9 eb8 flash memory (h8s/2319 f-ztat) h'ffc4 * 13 fccs ? ? ? ? ? ? ? sco 8 bits h'ffc5 * 13 fpcs ? ? ? ? ? ? ? ppvs h'ffc6 * 13 fecs ? ? ? ? ? ? ? epvb h'ffc7 * 13 reserved ? ? ? ? ? ? ? ? flash memory (h8s/2319c f-ztat) h'ffc8 * 13 fkey k7 k6 k5 k4 k3 k2 k1 k0 h'ffc9 * 13 fmats ms7 ms6 ms5 ms4 ms3 ms2 ms1 ms0 h'ffca * 13 ftdar tder tda6 tda5 tda4 tda3 tda2 tda1 tda0 h'ffcb * 13 reserved ? ? ? ? ? ? ? ? h'ffcc * 13 reserved ? ? ? ? ? ? ? ? 16 bits h'ffcd * 13 reserved ? ? ? ? ? ? ? ? h'ffce * 13 reserved ? ? ? ? ? ? ? ? h'ffcf * 13 reserved ? ? ? ? ? ? ? ?
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 947 of 1108 rej09b0089-0700 address register name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name data bus width h'ffd0 tcr0 cclr2 cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 tpu0 16 bits h'ffd1 tmdr0 ? ? bfb bfa md3 md2 md1 md0 h'ffd2 tior0h iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 h'ffd3 tior0l iod3 iod2 iod1 iod0 ioc3 ioc2 ioc1 ioc0 h'ffd4 tier0 ttge ? ? tciev tgied tgiec tgieb tgiea h'ffd5 tsr0 ? ? ? tcfv tgfd tgfc tgfb tgfa h'ffd6 tcnt0 h'ffd7 h'ffd8 tgr0a h'ffd9 h'ffda tgr0b h'ffdb h'ffdc tgr0c h'ffdd h'ffde tgr0d h'ffdf h'ffe0 tcr1 ? cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 tpu1 16 bits h'ffe1 tmdr1 ? ? ? ? md3 md2 md1 md0 h'ffe2 tior1 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 h'ffe4 tier1 ttge ? tcieu tciev ? ? tgieb tgiea h'ffe5 tsr1 tcfd ? tcfu tcfv ? ? tgfb tgfa h'ffe6 tcnt1 h'ffe7 h'ffe8 tgr1a h'ffe9 h'ffea tgr1b h'ffeb
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 948 of 1108 rej09b0089-0700 address register name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module name data bus width h'fff0 tcr2 ? cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 tpu2 16 bits h'fff1 tmdr2 ? ? ? ? md3 md2 md1 md0 h'fff2 tior2 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 h'fff4 tier2 ttge ? tcieu tciev ? ? tgieb tgiea h'fff5 tsr2 tcfd ? tcfu tcfv ? ? tgfb tgfa h'fff6 tcnt2 h'fff7 h'fff8 tgr2a h'fff9 h'fffa tgr2b h'fffb notes: 1. located in on-chip ram. the bus width is 32 bits when the dtc accesses this area as register information, and 16 bits otherwise. 2. valid only in the f-ztat versions but the h8s/2314 f-ztat. in the h8s/2314 f-ztat, this cannot be used and must not be accessed. 3. valid only in the f-ztat versions. 4. functions as c/ a for sci use, and as gm for smart card interface use. 5. functions as chr for sci use, and as blk for smart card interface use. 6. functions as stop for sci use, and as bcp1 for smart card interface use. 7. functions as mp for sci use, and as bcp0 for smart card interface use. 8. functions as fer for sci use, and as ers for smart card interface use. 9. valid in the h8s/2317 f-ztat only. 10. valid in the h8s/2318 f-ztat only. 11. valid in the h8s/2315 f-ztat, h8s/2314 f-ztat only. 12. valid in the h8s/2319 f-ztat only. 13. valid in the h8s/2319c f-ztat only.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 949 of 1108 rej09b0089-0700 b.2 list of registers (by module) module register abbreviation r/w initial value address * 1 system control register syscr r/w h'01 h'ff39 interrupt controller irq sense control register h iscrh r/w h'00 h'ff2c irq sense control register l iscrl r/w h'00 h'ff2d irq enable register ier r/w h'00 h'ff2e irq status register isr r/(w) * 2 h'00 h'ff2f interrupt priority register a ipra r/w h'77 h'fec4 interrupt priority register b iprb r/w h'77 h'fec5 interrupt priority register c iprc r/w h'77 h'fec6 interrupt priority register d iprd r/w h'77 h'fec7 interrupt priority register e ipre r/w h'77 h'fec8 interrupt priority register f iprf r/w h'77 h'fec9 interrupt priority register g iprg r/w h'77 h'feca interrupt priority register h iprh r/w h'77 h'fecb interrupt priority register i ipri r/w h'77 h'fecc interrupt priority register j iprj r/w h'77 h'fecd interrupt priority register k iprk r/w h'77 h'fece dtc dtc mode register a mra ? * 3 undefined ? * 4 dtc mode register b mrb ? * 3 undefined ? * 4 dtc source address register sar ? * 3 undefined ? * 4 dtc destination address register dar ? * 3 undefined ? * 4 dtc transfer count register a cra ? * 3 undefined ? * 4 dtc transfer count register b crb ? * 3 undefined ? * 4 dtc enable register dtcer r/w h'00 h'ff30 to h'ff34 dtc vector register dtvecr r/w h'00 h'ff37 module stop control register mstpcr r/w h'3fff h'ff3c
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 950 of 1108 rej09b0089-0700 module register abbreviation r/w initial value address * 1 bus width control register abwcr r/w h'ff/h'00 * 5 h'fed0 bus controller access state control register astcr r/w h'ff h'fed1 wait control register h wcrh r/w h'ff h'fed2 wait control register l wcrl r/w h'ff h'fed3 bus control register h bcrh r/w h'd0 h'fed4 bus control register l bcrl r/w h'3c h'fed5 timer control register 0 tcr0 r/w h'00 h'ffb0 8-bit timer 0 timer control/status register 0 tcsr0 r/(w) * 7 h'00 h'ffb2 timer constant register a0 tcora0 r/w h'ff h'ffb4 timer constant register b0 tcorb0 r/w h'ff h'ffb6 timer counter 0 tcnt0 r/w h'00 h'ffb8 timer control register 1 tcr1 r/w h'00 h'ffb1 8-bit timer 1 timer control/status register 1 tcsr1 r/(w) * 7 h'10 h'ffb3 timer constant register a1 tcora1 r/w h'ff h'ffb5 timer constant register b1 tcorb1 r/w h'ff h'ffb7 timer counter 1 tcnt1 r/w h'00 h'ffb9 all 8-bit timer channels module stop control register mstpcr r/w h'3fff h'ff3c wdt timer control/status register tcsr r/(w) * 9 h'18 h'ffbc: write * 8 h'ffbc: read timer counter tcnt r/w h'00 h'ffbc: write * 6 h'ffbd: read reset control/status register rstcsr r/(w) * 9 h'1f h'ffbe: write * 8 h'ffbf: read
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 951 of 1108 rej09b0089-0700 module register abbreviation r/w initial value address * 1 sci0 serial mode register 0 smr0 r/w h'00 h'ff78 bit rate register 0 brr0 r/w h'ff h'ff79 serial control register 0 scr0 r/w h'00 h'ff7a transmit data register 0 tdr0 r/w h'ff h'ff7b serial status register 0 ssr0 r/(w) * 2 h'84 h'ff7c receive data register 0 rdr0 r h'00 h'ff7d smart card mode register 0 scmr0 r/w h'f2 h'ff7e sci1 serial mode register 1 smr1 r/w h'00 h'ff80 bit rate register 1 brr1 r/w h'ff h'ff81 serial control register 1 scr1 r/w h'00 h'ff82 transmit data register 1 tdr1 r/w h'ff h'ff83 serial status register 1 ssr1 r/(w) * 2 h'84 h'ff84 receive data register 1 rdr1 r h'00 h'ff85 smart card mode register 1 scmr1 r/w h'f2 h'ff86 all sci channels module stop control register mstpcr r/w h'3fff h'ff3c smci0 serial mode register 0 smr0 r/w h'00 h'ff78 bit rate register 0 brr0 r/w h'ff h'ff79 serial control register 0 scr0 r/w h'00 h'ff7a transmit data register 0 tdr0 r/w h'ff h'ff7b serial status register 0 ssr0 r/(w) * 2 h'84 h'ff7c receive data register 0 rdr0 r h'00 h'ff7d smart card mode register 0 scmr0 r/w h'f2 h'ff7e smci1 serial mode register 1 smr1 r/w h'00 h'ff80 bit rate register 1 brr1 r/w h'ff h'ff81 serial control register 1 scr1 r/w h'00 h'ff82 transmit data register 1 tdr1 r/w h'ff h'ff83 serial status register 1 ssr1 r/(w) * 2 h'84 h'ff84 receive data register 1 rdr1 r h'00 h'ff85 smart card mode register 1 scmr1 r/w h'f2 h'ff86
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 952 of 1108 rej09b0089-0700 module register abbreviation r/w initial value address * 1 all smci channels module stop control register mstpcr r/w h'3fff h'ff3c adc a/d data register ah addrah r h'00 h'ff90 a/d data register al addral r h'00 h'ff91 a/d data register bh addrbh r h'00 h'ff92 a/d data register bl addrbl r h'00 h'ff93 a/d data register ch addrch r h'00 h'ff94 a/d data register cl addrcl r h'00 h'ff95 a/d data register dh addrdh r h'00 h'ff96 a/d data register dl addrdl r h'00 h'ff97 a/d control/status register adcsr r/(w) * 9 h'00 h'ff98 a/d control register adcr r/w h'3f h'ff99 module stop control register mstpcr r/w h'3fff h'ff3c dac0, 1 d/a data register 0 dadr0 r/w h'00 h'ffa4 d/a data register 1 dadr1 r/w h'00 h'ffa5 d/a control register 01 dacr01 r/w h'1f h'ffa6 all dac channels module stop control register mstpcr r/w h'3fff h'ff3c on-chip ram system control register syscr r/w h'01 h'ff39 tpu0 timer control register 0 tcr0 r/w h'00 h'ffd0 timer mode register 0 tmdr0 r/w h'c0 h'ffd1 timer i/o control register 0h tior0h r/w h'00 h'ffd2 timer i/o control register 0l tior0l r/w h'00 h'ffd3 timer interrupt enable register 0 tier0 r/w h'40 h'ffd4 timer status register 0 tsr0 r/(w) * 2 h'c0 h'ffd5 timer counter 0 tcnt0 r/w h'0000 h'ffd6 timer general register 0a tgr0a r/w h'ffff h'ffd8 timer general register 0b tgr0b r/w h'ffff h'ffda timer general register 0c tgr0c r/w h'ffff h'ffdc timer general register 0d tgr0d r/w h'ffff h'ffde tpu1 timer control register 1 tcr1 r/w h'00 h'ffe0 timer mode register 1 tmdr1 r/w h'c0 h'ffe1
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 953 of 1108 rej09b0089-0700 module register abbreviation r/w initial value address * 1 tpu1 timer i/o control register 1 tior1 r/w h'00 h'ffe2 timer interrupt enable register 1 tier1 r/w h'40 h'ffe4 timer status register 1 tsr1 r/(w) * 2 h'c0 h'ffe5 timer counter 1 tcnt1 r/w h'0000 h'ffe6 timer general register 1a tgr1a r/w h'ffff h'ffe8 timer general register 1b tgr1b r/w h'ffff h'ffea tpu2 timer control register 2 tcr2 r/w h'00 h'fff0 timer mode register 2 tmdr2 r/w h'c0 h'fff1 timer i/o control register 2 tior2 r/w h'00 h'fff2 timer interrupt enable register 2 tier2 r/w h'40 h'fff4 timer status register 2 tsr2 r/(w) * 2 h'c0 h'fff5 timer counter 2 tcnt2 r/w h'0000 h'fff6 timer general register 2a tgr2a r/w h'ffff h'fff8 timer general register 2b tgr2b r/w h'ffff h'fffa tpu3 timer control register 3 tcr3 r/w h'00 h'fe80 timer mode register 3 tmdr3 r/w h'c0 h'fe81 timer i/o control register 3h tior3h r/w h'00 h'fe82 timer i/o control register 3l tior3l r/w h'00 h'fe83 timer interrupt enable register 3 tier3 r/w h'40 h'fe84 timer status register 3 tsr3 r/(w) * 2 h'c0 h'fe85 timer counter 3 tcnt3 r/w h'0000 h'fe86 timer general register 3a tgr3a r/w h'ffff h'fe88 timer general register 3b tgr3b r/w h'ffff h'fe8a timer general register 3c tgr3c r/w h'ffff h'fe8c timer general register 3d tgr3d r/w h'ffff h'fe8e tpu4 timer control register 4 tcr4 r/w h'00 h'fe90 timer mode register 4 tmdr4 r/w h'c0 h'fe91 timer i/o control register 4 tior4 r/w h'00 h'fe92 timer interrupt enable register 4 tier4 r/w h'40 h'fe94 timer status register 4 tsr4 r/(w) * 2 h'c0 h'fe95 timer counter 4 tcnt4 r/w h'0000 h'fe96 timer general register 4a tgr4a r/w h'ffff h'fe98 timer general register 4b tgr4b r/w h'ffff h'fe9a
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 954 of 1108 rej09b0089-0700 module register abbreviation r/w initial value address * 1 tpu5 timer control register 5 tcr5 r/w h'00 h'fea0 timer mode register 5 tmdr5 r/w h'c0 h'fea1 timer i/o control register 5 tior5 r/w h'00 h'fea2 timer interrupt enable register 5 tier5 r/w h'40 h'fea4 timer status register 5 tsr5 r/(w) * 2 h'c0 h'fea5 timer counter 5 tcnt5 r/w h'0000 h'fea6 timer general register 5a tgr5a r/w h'ffff h'fea8 timer general register 5b tgr5b r/w h'ffff h'feaa timer start register tstr r/w h'00 h'ffc0 all tpu channels timer synchro register tsyr r/w h'00 h'ffc1 module stop control register mstpcr r/w h'3fff h'ff3c flash memory control register 1 flmcr1 * 14 r/w * 11 h'00/h'80 * 12 h'ffc8 * 10 flash memory flash memory control register 2 flmcr2 * 14 r/w * 11 h'00 h'ffc9 * 10 erase block register 1 ebr1 * 14 r/w * 11 h'00 * 13 h'ffca * 10 erase block register 2 ebr2 * 14 r/w * 11 h'00 * 13 h'ffcb * 10 ram emulation register ramer * 19 r/w h'00 h'fedb system control register 2 syscr2 * 15 r/w h'00 h'ff42 flash code control status register fccs * 20 r/w h'80 h'ffc4 flash program code select register fpcs * 20 r/w h'00 h'ffc5 flash erase code select register fecs * 20 r/w h'00 h'ffc6 flash key code register fkey * 20 r/w h'00 h'ffc8 flash mat select register fmats * 20 r/w h'00 / h'aa * 21 h'ffc9 flash transfer destination address register ftdar * 20 r/w h'00 h'ffca clock pulse generator system clock control register sckcr r/w h'00 h'ff3a mcu system control register syscr r/w h'01 h'ff39 mode control register mdcr r undefined h'ff3b
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 955 of 1108 rej09b0089-0700 module register abbreviation r/w initial value address * 1 standby control register sbycr r/w h'08 h'ff38 power- down state module stop control register h mstpcrh r/w h'3f h'ff3c module stop control register l mstpcrl r/w h'ff h'ff3d port 1 port 1 data direction register p1ddr w h'00 h'feb0 port 1 data register p1dr r/w h'00 h'ff60 port 1 register port1 r undefined h'ff50 port function control register 1 pfcr1 r/w h'0f h'ff45 port 2 port 2 data direction register p2ddr w h'00 h'feb1 port 2 data register p2dr r/w h'00 h'ff61 port 2 register port2 r undefined h'ff51 port 3 port 3 data direction register p3ddr w h'00 h'feb2 port 3 data register p3dr r/w h'00 h'ff62 port 3 register port3 r undefined h'ff52 port 3 open drain control register p3odr r/w h'00 h'ff76 port 4 port 4 register port4 r undefined h'ff53 port a port a data direction register paddr w h'0 * 16 h'feb9 port a data register padr r/w h'0 * 16 h'ff69 port a register porta r undefined * 16 h'ff59 port a mos pull-up control register papcr r/w h'0 * 16 h'ff70 port a open drain control register paodr r/w h'0 * 16 h'ff77 port b port b data direction register pbddr w h'00 h'feba port b data register pbdr r/w h'00 h'ff6a port b register portb r undefined h'ff5a port b mos pull-up control register pbpcr r/w h'00 h'ff71 port c port c data direction register pcddr w h'00 h'febb port c data register pcdr r/w h'00 h'ff6b port c register portc r undefined h'ff5b port c mos pull-up control register pcpcr r/w h'00 h'ff72 port d port d data direction register pdddr w h'00 h'febc port d data register pddr r/w h'00 h'ff6c port d register portd r undefined h'ff5c port d mos pull-up control register pdpcr r/w h'00 h'ff73
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 956 of 1108 rej09b0089-0700 module register abbreviation r/w initial value address * 1 port e port e data direction register peddr w h'00 h'febd port e data register pedr r/w h'00 h'ff6d port e register porte r undefined h'ff5d port e mos pull-up control register pepcr r/w h'00 h'ff74 port f port f data direction register pfddr w h'80/h'00 * 17 h'febe port f data register pfdr r/w h'00 h'ff6e port f register portf r undefined h'ff5e port function control register 1 pfcr1 r/w h'0f h'ff45 port function control register 2 pfcr2 r/w h'30 h'ffac system control register syscr r/w h'01 h'ff39 port g port g data direction register pgddr w h'10/h'00 * 17 * 18 h'febf port g data register pgdr r/w h'00 * 18 h'ff6f port g register portg r undefined * 18 h'ff5f port function control register 1 pfcr1 r/w h'0f h'ff45 port function control register 2 pfcr2 r/w h'30 h'ffac notes: 1. lower 16 bits of the address. 2. only 0 can be written for flag clearing. 3. registers in the dtc cannot be read or written to directly. 4. located as register information in on-chip ram addresses h'ebc0 to h'efbf. cannot be located in external memory space. do not clear the rame bit in syscr to 0 when using the dtc. 5. determined by the mcu operating mode. 6. bits used for pulse output cannot be written to. 7. only 0 can be written to bits 7 to 5, to clear the flags. 8. for information on writing, see section 11.2.4, notes on register access. 9. only 0 can be written to bit 7, to clear the flag. 10. flash memory registers selection is performed by means of the flshe bit in system control register 2 (syscr2). 11. in modes in which the on-chip flash memory is disabled, a read will return h'00, and writes are invalid. writes are also disabled when the fwe bit in flmcr1 is cleared to 0 (except for the h8s/2319 f-ztat). 12. in the h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f- ztat when a high level is input to the fwe pin, the initial value is h'80. in the h8s/2319 f-ztat, the initial value is h'80. 13. in the h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f- ztat when a low level is input to the fwe pin, or if a high level is input but the swe bit in flmcr1 is not set, these registers are initialized to h'00.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 957 of 1108 rej09b0089-0700 in the h8s/2319 f-ztat, the eb11 to eb0 bits are initialized to 0 when the swe1 bit is not set to 1, and the eb15 to eb12 bits are initialized to 0 when the swe2 bit is not set to 1. 14. flmcr1, flmcr2, ebr1, and ebr2 are 8-bit registers. only byte access can be used on these registers, with the access requiring two states (applies to the f-ztat versions but the h8s/2319c f-ztat). 15. the syscr2 register can only be used in the f-ztat versions. in the mask rom versions this register will return an undefined value if read, and cannot be written to. 16. value of bits 3 to 0. 17. the initial value depends on the mode. 18. value of bits 4 to 0. 19. valid only in the f-ztat versions but the h8s/2314 f-ztat. in the h8s/2314 f-ztat, this cannot be used and must not be accessed. 20. this applies to the h8s/2319c f-ztat only. access is possible when the on-chip flash memory is enabled. 21. the initial value after startup is h'00 in the user boot mode and user program mode. the initial value after startup in the user boot mode is h'aa.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 958 of 1108 rej09b0089-0700 b.3 functions mra?dtc mode register a h'f800?h'fbff dtc 7 sm1 undefined ? 6 sm0 undefined ? 5 dm1 undefined ? 4 dm0 undefined ? 3 md1 undefined ? 0 sz undefined ? 2 md0 undefined ? 1 dts undefined ? bit initial value read/write : : : 0 1 source address mode ? 0 1 0 1 destination address mode ? 0 1 dtc mode 0 1 normal mode repeat mode block transfer mode ? 0 1 0 1 dtc data transfer size 0 1 byte-size transfer dtc transfer mode select 0 1 word-size transfer destination side is repeat area or block area source side is repeat area or block area dar is incremented after a transfer (by +1 when sz = 0; by +2 when sz = 1) dar is decremented after a transfer (by ? 1 when sz = 0; by ? 2 when sz = 1) dar is fixed sar is incremented after a transfer (by +1 when sz = 0; by +2 when sz = 1) sar is decremented after a transfer (by ? 1 when sz = 0; by ? 2 when sz = 1) sar is fixed
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 959 of 1108 rej09b0089-0700 mrb?dtc mode register b h'f800?h'fbff dtc 0 1 after dtc data transfer ends, the cpu interrupt is disabled unless the transfer counter is 0 after dtc data transfer ends, the cpu interrupt is enabled 7 chne undefined ? 6 disel undefined ? 5 chns undefined ? 4 ? undefined ? 3 ? undefined ? 0 ? undefined ? 2 ? undefined ? 1 ? undefined ? bit initial value read/write : : : dtc chain transfer enable dtc chain transfer select chne 0 1 1 chns ? 0 1 description no chain transfer (at end of dtc data transfer, dtc waits for activation) chain transfer every time chain transfer only when transfer counter = 0 dtc interrupt select reserved only 0 should be written to these bits sar?dtc source address register h'f800?h'fbff dtc 23 bit initial value read/write : : : 22 21 20 19 43210 - - - - - - - - - - - - specifies dtc transfer data source address unde- fined ? unde- fined ? unde- fined ? unde- fined ? unde- fined ? unde- fined unde- fined unde- fined unde- fined unde- fined ?????
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 960 of 1108 rej09b0089-0700 dar?dtc destination address register h'f800?h'fbff dtc 23 bit initial value read/write : : : 22 21 20 19 43210 - - - - - - - - - - - - specifies dtc transfer data destination address unde- fined ? unde- fined ? unde- fined ? unde- fined ? unde- fined ? unde- fined ? unde- fined ? unde- fined ? unde- fined ? unde- fined ? cra?dtc transfer count register a h'f800?h'fbff dtc 15 bit initial value read/write : : : 14 13 12 11109876543210 crah cral specifies the number of dtc data transfers unde- fined ? unde- fined ? unde- fined ? unde- fined ? unde- fined ? unde- fined unde- fined unde- fined unde- fined unde- fined ????? unde- fined unde- fined unde- fined unde- fined unde- fined ????? unde- fined ? crb?dtc transfer count register b h'f800?h'fbff dtc 15 14 13 12 11109876543210 specifies the number of dtc block data transfers bit initial value read/write : : : unde- fined ? unde- fined ? unde- fined ? unde- fined ? unde- fined ? unde- fined unde- fined unde- fined unde- fined unde - fined ????? unde- fined unde- fined unde- fined unde- fined unde- fined ????? unde- fined ?
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 961 of 1108 rej09b0089-0700 tcr3?timer control register 3 h'fe80 tpu3 7 cc l r2 0 r / w 6 cc l r1 0 r / w 5 cc l r0 0 r / w 4 c keg 1 0 r / w 3 c keg 0 0 r / w 0 t psc0 0 r / w 2 t psc2 0 r / w 1 t psc1 0 r / w b i t i n i t i a l va l ue read / wr i te : : : t c nt c l ear i n g d i sab l ed t c nt c l eared by tg ra compare match /i nput capture t c nt c l eared by tg rb compare match /i nput capture t c nt c l ear i n g d i sab l ed t c nt c l eared by tg rc compare match /i nput capture * 2 t c nt c l eared by tg rd compare match /i nput capture * 2 counter c l ear 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 c l ock e d g e 0 1 ? count at r i s i n g ed g e count at fa lli n g ed g e count at both ed g es i nterna l c l ock : counts on / 1 i nterna l c l ock : counts on /4 i nterna l c l ock : counts on / 16 i nterna l c l ock : counts on / 6 4 e xterna l c l ock : counts on t c lk a p i n i nput i nterna l c l ock : counts on / 102 4 i nterna l c l ock : counts on / 256 i nterna l c l ock : counts on /4 096 ti mer presca l er 0 1 0 1 0 1 0 1 0 1 0 1 0 1 t c nt c l eared by counter c l ear i n g for another channe l perform i n g synchronous c l ear i n g/ synchronous operat i on * 1 t c nt c l eared by counter c l ear i n g for another channe l perform i n g synchronous c l ear i n g/ synchronous operat i on * 1 n otes : 1 . 2 . synchronous operat i on sett i n g i s performed by sett i n g the s yn c b i t i n t s y r to 1 . when tg rc or tg rd i s used as a buffer re gi ster, t c nt i s not c l eared because the buffer re gi ster sett i n g has pr i or i ty, and compare match /i nput capture does not occur . n ote : t he i nterna l c l ock ed g e se l ect i on i s va li d when the i nput c l ock i s /4 or s l ower . t h i s sett i n g i s ig nored i f / 1 or overf l ow / underf l ow on another channe l i s se l ected as the i nput c l ock .
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 962 of 1108 rej09b0089-0700 tmdr3?timer mode register 3 h'fe81 tpu3 7 ? 1 ? 6 ? 1 ? 5 bfb 0 r/w 4 bfa 0 r/w 3 md3 0 r/w 0 md0 0 r/w 2 md2 0 r/w 1 md1 0 r/w bit initial value read/write : : : 0 buffer operation b t g rb operates normally 0 buffer operation a t g ra operates normally 0 1 normal operation reserved pwm mode 1 pwm mode 2 phase countin g mode 1 phase countin g mode 2 phase countin g mode 3 phase countin g mode 4 ? mode 0 1 0 1 0 1 0 1 0 1 0 1 0 1 notes: 1. 2. : don't care md3 is a reserved bit. in a write, it should always be written with 0. phase countin g mode cannot be set for channels 0 and 3. in this case, 0 should always be written to md2. t g ra and t g rc used to g ether for buffer operation 1 t g rb and t g rd used to g ether for buffer operation 1
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 963 of 1108 rej09b0089-0700 tior3h?timer i/o control register 3h h'fe82 tpu3 0 1 t g r3b i/o control 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 t g r3a is output compare re g ister t g r3a i/o control 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 output disabled 0 output at compare match 1 output at compare match to gg le output at compare match 0 output at compare match 1 output at compare match to gg le output at compare match input capture at risin g ed g e input capture at fallin g ed g e input capture at both ed g es : don't care : don't care 7 iob3 0 r/w 6 iob2 0 r/w 5 iob1 0 r/w 4 iob0 0 r/w 3 ioa3 0 r/w 0 ioa0 0 r/w 2 ioa2 0 r/w 1 ioa1 0 r/w bit initial value read/write : : : t g r3a is input capture re g ister initial output is 0 output output disabled initial output is 1 output capture input source is tioca3 pin capture input source is channel 4/count clock input capture at tcnt4 count-up/ count-down t g r3b is output compare re g ister output disabled 0 output at compare match 1 output at compare match to gg le output at compare match 0 output at compare match 1 output at compare match to gg le output at compare match input capture at risin g ed g e input capture at fallin g ed g e input capture at both ed g es t g r3b is input capture re g ister initial output is 0 output output disabled initial output is 1 output capture input source is tiocb3 pin capture input source is channel 4/count clock input capture at tcnt4 count-up/ count-down * note: * when bits tpsc2 to tpsc0 in tcr4 are set to b'000, and /1 is used as the tcnt4 count clock, this settin g is invalid and input capture does not occur.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 964 of 1108 rej09b0089-0700 tior3l?timer i/o control register 3l h'fe83 tpu3 0 1 t g r3d i/o control 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 t g r3c is output compare re g ister * 1 t g r3c i/o control 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 output disabled 0 output at compare match 1 output at compare match to gg le output at compare match : don't care : don't care notes: note: * when the bfa bit in tmdr3 is set to 1 and t g r3c is used as a buffer re g ister, this settin g is invalid and input capture/output compare does not occur. note: when t g rc or t g rd is desi g nated for buffer operation, this settin g is invalid and the re g ister operates as a buffer re g ister. 7 iod3 0 r/w 6 iod2 0 r/w 5 iod1 0 r/w 4 iod0 0 r/w 3 ioc3 0 r/w 0 ioc0 0 r/w 2 ioc2 0 r/w 1 ioc1 0 r/w bit initial value read/write : : : initial output is 0 output output disabled 0 output at compare match 1 output at compare match to gg le output at compare match initial output is 1 output input capture at risin g ed g e input capture at fallin g ed g e input capture at both ed g es capture input source is tiocc3 pin t g r3c is input capture re g ister * capture input source is channel 4/count clock input capture at tcnt4 count-up/ count-down t g r3d is output compare re g ister * 2 output disabled 0 output at compare match 1 output at compare match to gg le output at compare match initial output is 0 output output disabled 0 output at compare match 1 output at compare match to gg le output at compare match initial output is 1 output input capture at risin g ed g e input capture at fallin g ed g e input capture at both ed g es capture input source is tiocd3 pin t g r3d is input capture re g ister * 2 capture input source is channel 4/count clock input capture at tcnt4 count-up/ count-down * 1 1. when bits tpsc2 to tpsc0 in tcr4 are set to b'000 and /1 is used as the tcnt4 count clock, this settin g is invalid and input capture does not occur. 2. when the bfb bit in tmdr3 is set to 1 and t g r3d is used as a buffer re g ister, this settin g is invalid and input capture/output compare does not occur.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 965 of 1108 rej09b0089-0700 tier3?timer interrupt enable register 3 h'fe84 tpu3 7 tt g e 0 r/w 6 ? 1 ? 5 ? 0 ? 4 tciev 0 r/w 3 t g ied 0 r/w 0 t g iea 0 r/w 2 t g iec 0 r/w 1 t g ieb 0 r/w bit initial value read/write : : : 0 1 a/d conversion start request g eneration disabled a/d conversion start request g eneration enabled a/d conversion start request enable 0 1 interrupt request (tciv) by tcfv disabled interrupt request (tciv) by tcfv enabled overflow interrupt enable t g r interrupt enable d t g r interrupt enable c t g r interrupt enable b 0 1 interrupt request (t g ia) by t g fa bit disabled t g r interrupt enable a 0 1 0 1 0 1 interrupt request (t g ia) by t g fa bit enabled interrupt request (t g ib) by t g fb bit disabled interrupt request (t g ib) by t g fb bit enabled interrupt request (t g ic) by t g fc bit disabled interrupt request (t g ic) by t g fc bit enabled interrupt request (t g id) by t g fd bit disabled interrupt request (t g id) by t g fd bit enabled
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 966 of 1108 rej09b0089-0700 tsr3?timer status register 3 h'fe85 tpu3 7 ? 1 ? 6 ? 1 ? 5 ? 0 ? 4 tcfv 0 r/(w) * 3 t g fd 0 r/(w) * 0 t g fa 0 r/(w) * 2 t g fc 0 r/(w) * 1 t g fb 0 r/(w) * bit initial value read/write : : : note: * can only be written with 0 for fla g clearin g . 0 [clearin g condition] when 0 is written to tcfv after readin g tcfv = 1 overflow fla g 1 [settin g condition] when the tcnt value overflows (chan g es from h'ffff to h'0000 ) 0 [clearin g conditions] ? when dtc is activated by t g id interrupt while disel bit of mrb in dtc is 0 ? when 0 is written to t g fd after readin g t g fd = 1 input capture/output compare fla g d 1 [settin g conditions] 0 [clearin g conditions] ? when dtc is activated by t g ic interrupt while disel bit of mrb in dtc is 0 ? when 0 is written to t g fc after readin g t g fc = 1 input capture/output compare fla g c 1 [settin g conditions] 0 [clearin g conditions] ? when dtc is activated by t g ib interrupt while disel bit of mrb in dtc is 0 ? when 0 is written to t g fb after readin g t g fb = 1 input capture/output compare fla g b 1 [settin g conditions] 0 [clearin g conditions] ? when dtc is activated by t g ia interrupt while disel bit of mrb in dtc is 0 ? when 0 is written to t g fa after readin g t g fa = 1 input capture/output compare fla g a 1 [settin g conditions] ? when tcnt=t g ra while t g ra is function- in g as output compare re g ister ? when tcnt value is transferred to t g ra by input capture si g nal while t g ra is functionin g as input capture re g ister ? when tcnt = t g rb while t g rb is functionin g as output compare re g ister ? when tcnt value is transferred to t g rb by input capture si g nal while t g rb is functionin g as input capture re g ister ? when tcnt = t g rc while t g rc is functionin g as output compare re g ister ? when tcnt value is transferred to t g rc by input capture si g nal while t g rc is functionin g as input capture re g ister ? when tcnt = t g rd while t g rd is functionin g as output compare re g ister ? when tcnt value is transferred to t g rd by input capture si g nal while t g rd is functionin g as input capture re g ister
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 967 of 1108 rej09b0089-0700 tcnt3?timer counter 3 h'fe86 tpu3 15 0 r/w 14 0 r/w 13 0 r/w 12 0 r/w 11 0 r/w 8 0 r/w 10 0 r/w 9 0 r/w bit initial value read/write : : : 7 0 r/w 6 0 r/w 5 0 r/w 4 0 r/w 3 0 r/w 0 0 r/w 2 0 r/w 1 0 r/w up-counter tgr3a?timer general register 3a h'fe88 tpu3 tgr3b?timer general register 3b h'fe8a tpu3 tgr3c?timer general register 3c h'fe8c tpu3 tgr3d?timer general register 3d h'fe8e tpu3 15 1 r/w 14 1 r/w 13 1 r/w 12 1 r/w 11 1 r/w 8 1 r/w 10 1 r/w 9 1 r/w bit initial value read/write : : : 7 1 r/w 6 1 r/w 5 1 r/w 4 1 r/w 3 1 r/w 0 1 r/w 2 1 r/w 1 1 r/w
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 968 of 1108 rej09b0089-0700 tcr4?timer control register 4 h'fe90 tpu4 tcnt clearin g disabled tcnt cleared by t g ra compare match/input capture tcnt cleared by t g rb compare match/input capture counter clear 0 1 0 1 0 1 0 1 clock ed g e 0 1 ? count at risin g ed g e count at fallin g ed g e count at both ed g es internal clock: counts on /1 internal clock: counts on /4 internal clock: counts on /16 internal clock: counts on /64 external clock: counts on tclka pin input external clock: counts on tclkc pin input internal clock: counts on /1024 counts on tcnt5 overflow/underflow timer prescaler 0 1 0 1 0 1 0 1 0 1 0 1 0 1 7 ? 0 ? 6 cclr1 0 r/w 5 cclr0 0 r/w 4 cke g 1 0 r/w 3 cke g 0 0 r/w 0 tpsc0 0 r/w 2 tpsc2 0 r/w 1 tpsc1 0 r/w bit initial value read/write : : : note: this settin g is i g nored when channel 4 is in phase countin g mode. note: * synchronous operation settin g is performed by settin g the sync bit in tsyr to 1. note: this settin g is i g nored when channel 4 is in phase countin g mode. the internal clock ed g e selection is valid when the input clock is /4 or slower. this settin g is i g nored if /1 or overflow/underflow on another channel is selected as the input clock. tcnt cleared by counter clearin g for another channel performin g synchronous clearin g /synchronous operation *
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 969 of 1108 rej09b0089-0700 tmdr4?timer mode register 4 h'fe91 tpu4 0 1 normal operation reserved pwm mode 1 pwm mode 2 phase countin g mode 1 phase countin g mode 2 phase countin g mode 3 phase countin g mode 4 ? mode 0 1 0 1 0 1 0 1 0 1 0 1 0 1 note: : don't care 7 ? 1 ? 6 ? 1 ? 5 ? 0 ? 4 ? 0 ? 3 md3 0 r/w 0 md0 0 r/w 2 md2 0 r/w 1 md1 0 r/w bit initial value read/write : : : md3 is a reserved bit. in a write, it should always be written with 0.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 970 of 1108 rej09b0089-0700 tior4?timer i/o control register 4 h'fe92 tpu4 7 iob3 0 r/w 6 iob2 0 r/w 5 iob1 0 r/w 4 iob0 0 r/w 3 ioa3 0 r/w 0 ioa0 0 r/w 2 ioa2 0 r/w 1 ioa1 0 r/w bit initial value read/write : : : 0 1 t g r4b is output compare re g ister t g r4b i/o control 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 t g r4a i/o control : don't care 0 1 t g r4a is output compare re g ister 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 output disabled 0 output at compare match 1 output at compare match to gg le output at compare match : don't care initial output is 0 output output disabled 0 output at compare match 1 output at compare match to gg le output at compare match initial output is 1 output input capture at risin g ed g e input capture at fallin g ed g e input capture at both ed g es t g r4a is input capture re g ister capture input source is tioca4 pin input capture at g eneration of t g r3a compare match/input capture capture input source is t g r3a compare match/ input capture output disabled 0 output at compare match 1 output at compare match to gg le output at compare match initial output is 0 output output disabled 0 output at compare match 1 output at compare match to gg le output at compare match initial output is 1 output input capture at risin g ed g e input capture at fallin g ed g e input capture at both ed g es t g r4b is input capture re g ister capture input source is tiocb4 pin input capture at g eneration of t g r3c compare match/input capture capture input source is t g r3c compare match/ input capture
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 971 of 1108 rej09b0089-0700 tier4?timer interrupt enable register 4 h'fe94 tpu4 7 tt g e 0 r/w 6 ? 1 ? 5 tcieu 0 r/w 4 tciev 0 r/w 3 ? 0 ? 0 t g iea 0 r/w 2 ? 0 ? 1 t g ieb 0 r/w bit initial value read/write : : : 0 1 0 1 0 1 interrupt request (t g ia) by t g fa bit disabled t g r interrupt enable a 0 1 0 1 interrupt request (t g ia) by t g fa bit enabled interrupt request (t g ib) by t g fb bit disabled interrupt request (t g ib) by t g fb bit enabled t g r interrupt enable b interrupt request (tciv) by tcfv disabled interrupt request (tciv) by tcfv enabled overflow interrupt enable underflow interrupt enable interrupt request (tciu) by tcfu disabled interrupt request (tciu) by tcfu enabled a/d conversion start request enable a/d conversion start request g eneration disabled a/d conversion start request g eneration enabled
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 972 of 1108 rej09b0089-0700 tsr4?timer status register 4 h'fe95 tpu4 7 tcfd 1 r 6 ? 1 ? 5 tcfu 0 r/(w) * 4 tcfv 0 r/(w) * 3 ? 0 ? 0 t g fa 0 r/(w) * 2 ? 0 ? 1 t g fb 0 r/(w) * bit initial value read/write : : : 0 1 tcnt counts down tcnt counts up count direction fla g 0 [clearin g condition] when 0 is written to tcfu after readin g tcfu = 1 underflow fla g 1 [settin g condition] when the tcnt value underflows (chan g es from h'0000 to h'ffff) 0 [clearin g condition] when 0 is written to tcfv after readin g tcfv = 1 overflow fla g 1 [settin g condition] when the tcnt value overflows (chan g es from h'ffff to h'0000) 0 input capture/output compare fla g b 1 0 [clearin g conditions] ? when dtc is activated by t g ia interrupt while disel bit of mrb in dtc is 0 ? when 0 is written to t g fa after readin g t g fa = 1 input capture/output compare fla g a 1 [settin g conditions] note: * can only be written with 0 for fla g clearin g . ? when tcnt = t g ra while t g ra is functionin g as output compare re g ister ? when tcnt value is transferred to t g ra by input capture si g nal while t g ra is functionin g as input capture re g ister [clearin g conditions] ? when dtc is activated by t g ib interrupt while disel bit of mrb in dtc is 0 ? when 0 is written to t g fb after readin g t g fb = 1 [settin g conditions] ? when tcnt = t g rb while t g rb is functionin g as output compare re g ister ? when tcnt value is transferred to t g rb by input capture si g nal while t g rb is functionin g as input capture re g ister
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 973 of 1108 rej09b0089-0700 tcnt4?timer counter 4 h'fe96 tpu4 15 0 r/w 14 0 r/w 13 0 r/w 12 0 r/w 11 0 r/w 8 0 r/w 10 0 r/w 9 0 r/w bit initial value read/write : : : 7 0 r/w 6 0 r/w 5 0 r/w 4 0 r/w 3 0 r/w 0 0 r/w 2 0 r/w 1 0 r/w note: * this timer counter can be used as an up/down-counter only in phase countin g mode or when performin g overflow/underflow countin g on another channel. in other cases it functions as an up-counter. up/down-counter * tgr4a?timer general register 4a h'fe98 tpu4 tgr4b?timer general register 4b h'fe9a tpu4 15 1 r/w 14 1 r/w 13 1 r/w 12 1 r/w 11 1 r/w 8 1 r/w 10 1 r/w 9 1 r/w bit initial value read/write : : : 7 1 r/w 6 1 r/w 5 1 r/w 4 1 r/w 3 1 r/w 0 1 r/w 2 1 r/w 1 1 r/w
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 974 of 1108 rej09b0089-0700 tcr5?timer control register 5 h'fea0 tpu5 tcnt clearin g disabled tcnt cleared by t g ra compare match/input capture tcnt cleared by t g rb compare match/input capture counter clear 0 1 0 1 0 1 internal clock: counts on /1 internal clock: counts on /4 internal clock: counts on /16 internal clock: counts on /64 external clock: counts on tclka pin input external clock: counts on tclkc pin input internal clock: counts on /256 external clock: counts on tclkd pin input time prescaler 0 1 0 1 0 1 0 1 0 1 0 1 0 1 7 ? 0 ? 6 cclr1 0 r/w 5 cclr0 0 r/w 4 cke g 1 0 r/w 3 cke g 0 0 r/w 0 tpsc0 0 r/w 2 tpsc2 0 r/w 1 tpsc1 0 r/w bit initial value read/write : : : note: 0 1 clock ed g e 0 1 ? count at risin g ed g e count at fallin g ed g e count at both ed g es this settin g is i g nored when channel 5 is in phase countin g mode. note: * synchronous operation settin g is performed by settin g the sync bit in tsyr to 1. note: this settin g is i g nored when channel 5 is in phase countin g mode. the internal clock ed g e selection is valid when the input clock is /4 or slower. this settin g is i g nored if /1 or overflow/underflow on another channel is selected as the input clock. tcnt cleared by counter clearin g for another channel performin g synchronous clearin g /synchronous operation *
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 975 of 1108 rej09b0089-0700 tmdr5?timer mode register 5 h'fea1 tpu5 0 1 normal operation reserved pwm mode 1 pwm mode 2 phase countin g mode 1 phase countin g mode 2 phase countin g mode 3 phase countin g mode 4 ? mode 0 1 0 1 0 1 0 1 0 1 0 1 0 1 note: md3 is a reserved bit. in a write, it should always be written with 0. : don't care 7 ? 1 ? 6 ? 1 ? 5 ? 0 ? 4 ? 0 ? 3 md3 0 r/w 0 md0 0 r/w 2 md2 0 r/w 1 md1 0 r/w bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 976 of 1108 rej09b0089-0700 tior5?timer i/o control register 5 h'fea2 tpu5 7 iob3 0 r/w 6 iob2 0 r/w 5 iob1 0 r/w 4 iob0 0 r/w 3 ioa3 0 r/w 0 ioa0 0 r/w 2 ioa2 0 r/w 1 ioa1 0 r/w bit initial value read/write : : : 0 1 t g r5b i/o control 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 t g r5a is output compare re g ister t g r5a i/o control 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 output disabled 0 output at compare match 1 output at compare match to gg le output at compare match : don't care t g r5a is input capture re g ister initial output is 0 output output disabled 0 output at compare match 1 output at compare match to gg le output at compare match initial output is 1 output input capture at risin g ed g e input capture at fallin g ed g e input capture at both ed g es capture input source is tioca5 pin t g r5b is output compare re g ister output disabled 0 output at compare match 1 output at compare match to gg le output at compare match : don't care t g r5b is input capture re g ister initial output is 0 output output disabled 0 output at compare match 1 output at compare match to gg le output at compare match initial output is 1 output input capture at risin g ed g e input capture at fallin g ed g e input capture at both ed g es capture input source is tiocb5 pin
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 977 of 1108 rej09b0089-0700 tier5?timer interrupt enable register 5 h'fea4 tpu5 7 tt g e 0 r/w 6 ? 1 ? 5 tcieu 0 r/w 4 tciev 0 r/w 3 ? 0 ? 0 t g iea 0 r/w 2 ? 0 ? 1 t g ieb 0 r/w bit initial value read/write : : : 0 1 a/d conversion start request g eneration disabled a/d conversion start request g eneration enabled a/d conversion start request enable 0 1 interrupt request (tciu) by tcfu disabled interrupt request (tciu) by tcfu enabled underflow interrupt enable t g r interrupt enable b 0 1 interrupt request (t g ia) by t g fa bit disabled t g r interrupt enable a 0 1 0 1 overflow interrupt enable interrupt request (t g ia) by t g fa bit enabled interrupt request (t g ib) by t g fb bit disabled interrupt request (t g ib) by t g fb bit enabled interrupt request (tciv) by tcfv disabled interrupt request (tciv) by tcfv enabled
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 978 of 1108 rej09b0089-0700 tsr5?timer status register 5 h'fea5 tpu5 7 tcfd 1 r 6 ? 1 ? 5 tcfu 0 r/(w) * 4 tcfv 0 r/(w) * 3 ? 0 ? 0 t g fa 0 r/(w) * 2 ? 0 ? 1 t g fb 0 r/(w) * bit initial value read/write : : : 0 1 tcnt counts down tcnt counts up count direction fla g 0 underflow fla g 1 0 overflow fla g 1 0 input capture/output compare fla g b 1 0 [clearin g conditions] ? when dtc is activated by t g ia interrupt while disel bit of mrb in dtc is 0 ? when 0 is written to t g fa after readin g t g fa = 1 input capture/output compare fla g a 1 [settin g conditions] ? when tcnt = t g ra while t g ra is functionin g as output compare re g ister ? when tcnt value is transferred to t g ra by input capture si g nal while t g ra is functionin g as input capture re g ister note: * can only be written with 0 for fla g clearin g . [clearin g conditions] ? when dtc is activated by t g ib interrupt while disel bit of mrb in dtc is 0 ? when 0 is written to t g fb after readin g t g fb = 1 [settin g conditions] ? when tcnt = t g rb while t g rb is functionin g as output compare re g ister ? when tcnt value is transferred to t g rb by input capture si g nal while t g rb is functionin g as input capture re g ister [clearin g condition] when 0 is written to tcfv after readin g tcfv = 1 [settin g condition] when the tcnt value overflows (chan g es from h'ffff to h'0000 ) [clearin g condition] when 0 is written to tcfu after readin g tcfu = 1 [settin g condition] when the tcnt value underflows (chan g es from h'0000 to h'ffff)
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 979 of 1108 rej09b0089-0700 tcnt5?timer counter 5 h'fea6 tpu5 15 0 r/w 14 0 r/w 13 0 r/w 12 0 r/w 11 0 r/w 8 0 r/w 10 0 r/w 9 0 r/w bit initial value read/write : : : 7 0 r/w 6 0 r/w 5 0 r/w 4 0 r/w 3 0 r/w 0 0 r/w 2 0 r/w 1 0 r/w note: * this timer counter can be used as an up/down-counter only in phase countin g mode or when performin g overflow/underflow countin g on another channel. in other cases it functions as an up-counter. up/down-counter * tgr5a?timer general register 5a h'fea8 tpu5 tgr5b?timer general register 5b h'feaa tpu5 15 1 r/w 14 1 r/w 13 1 r/w 12 1 r/w 11 1 r/w 8 1 r/w 10 1 r/w 9 1 r/w bit initial value read/write : : : 7 1 r/w 6 1 r/w 5 1 r/w 4 1 r/w 3 1 r/w 0 1 r/w 2 1 r/w 1 1 r/w p1ddr?port 1 data direction register h'feb0 port 1 7 p17ddr 0 w 6 p16ddr 0 w 5 p15ddr 0 w 4 p14ddr 0 w 3 p13ddr 0 w 0 p10ddr 0 w 2 p12ddr 0 w 1 p11ddr 0 w bit initial value read/write : : : specify input or output for individual port 1 pins
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 980 of 1108 rej09b0089-0700 p2ddr?port 2 data direction register h'feb1 port 2 7 p27ddr 0 w 6 p26ddr 0 w 5 p25ddr 0 w 4 p24ddr 0 w 3 p23ddr 0 w 0 p20ddr 0 w 2 p22ddr 0 w 1 p21ddr 0 w specify input or output for individual port 2 pins bit initial value read/write : : : p3ddr?port 3 data direction register h'feb2 port 3 7 ? undefined ? 6 ? undefined ? 5 p35ddr 0 w 4 p34ddr 0 w 3 p33ddr 0 w 0 p30ddr 0 w 2 p32ddr 0 w 1 p31ddr 0 w specify input or output for individual port 3 pins bit initial value read/write : : : paddr?port a data direction register h'feb9 port a 7 undefined 6 undefined 5 undefined 4 undefined 3 pa3ddr 0 w 0 pa0ddr 0 w 2 pa2ddr 0 w 1 pa1ddr 0 w bit initial value read/write : : : specify input or output for individual port a pins
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 981 of 1108 rej09b0089-0700 pbddr?port b data direction register h'feba port b 7 pb7ddr 0 w 6 pb6ddr 0 w 5 pb5ddr 0 w 4 pb4ddr 0 w 3 pb3ddr 0 w 0 pb0ddr 0 w 2 pb2ddr 0 w 1 pb1ddr 0 w specify input or output for individual port b pins bit initial value read/write : : : pcddr?port c data direction register h'febb port c 7 pc7ddr 0 w 6 pc6ddr 0 w 5 pc5ddr 0 w 4 pc4ddr 0 w 3 pc3ddr 0 w 0 pc0ddr 0 w 2 pc2ddr 0 w 1 pc1ddr 0 w specify input or output for individual port c pins bit initial value read/write : : : pdddr?port d data direction register h'febc port d 7 pd7ddr 0 w 6 pd6ddr 0 w 5 pd5ddr 0 w 4 pd4ddr 0 w 3 pd3ddr 0 w 0 pd0ddr 0 w 2 pd2ddr 0 w 1 pd1ddr 0 w bit initial value read/write : : : specify input or output for individual port d pins
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 982 of 1108 rej09b0089-0700 peddr?port e data direction register h'febd port e 7 pe7ddr 0 w 6 pe6ddr 0 w 5 pe5ddr 0 w 4 pe4ddr 0 w 3 pe3ddr 0 w 0 pe0ddr 0 w 2 pe2ddr 0 w 1 pe1ddr 0 w specify input or output for individual port e pins bit initial value read/write : : : pfddr?port f data direction register h'febe port f 7 pf7ddr 1 w 0 w 6 pf6ddr 0 w 0 w 5 pf5ddr 0 w 0 w 4 pf4ddr 0 w 0 w 3 pf3ddr 0 w 0 w 0 pf0ddr 0 w 0 w 2 pf2ddr 0 w 0 w 1 pf1ddr 0 w 0 w specify input or output for individual port f pins bit modes 4 to 6 * initial value read/write mode 7 * initial value read/write : : : : : note: * modes 6 and 7 cannot be used in the romless versions.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 983 of 1108 rej09b0089-0700 pgddr?port g data direction register h'febf port g 7 ? undefined ? undefined ? 6 ? undefined ? undefined ? 5 ? undefined ? undefined ? 4 p g 4ddr 1 w 0 w 3 p g 3ddr 0 w 0 w 0 p g 0ddr 0 w 0 w 2 p g 2ddr 0 w 0 w 1 p g 1ddr 0 w 0 w specify input or output for individual port g pins note: * modes 6 and 7 cannot be used in the romless versions. bit modes 4 and 5 initial value read/write modes 6 and 7 initial value read/write : : : * : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 984 of 1108 rej09b0089-0700 ipra?interrupt priority register a h'fec4 interrupt controller iprb?interrupt priority register b h'fec5 interrupt controller iprc?interrupt priority register c h'fec6 interrupt controller iprd?interrupt priority register d h'fec7 interrupt controller ipre?interrupt priority register e h'fec8 interrupt controller iprf?interrupt priority register f h'fec9 interrupt controller iprg?interrupt priority register g h'feca interrupt controller iprh?interrupt priority register h h'fecb interrupt controller ipri?interrupt priority register i h'fecc interrupt controller iprj?interrupt priority register j h'fecd interrupt controller iprk?interrupt priority register k h'fece interrupt controller 7 ? 0 ? 6 ipr6 1 r/w 5 ipr5 1 r/w 4 ipr4 1 r/w 3 ? 0 ? 0 ipr0 1 r/w 2 ipr2 1 r/w 1 ipr1 1 r/w set priority (levels 7 to 0) for interrupt sources ipra iprb iprc iprd ipre iprf ipr g iprh ipri iprj iprk re g ister bits irq0 irq2 irq3 irq6 irq7 wdt ? * tpu channel 0 tpu channel 2 tpu channel 4 8-bit timer channel 0 ? * sci channel 1 irq1 irq4 irq5 dtc ? * a/d converter tpu channel 1 tpu channel 3 tpu channel 5 8-bit timer channel 1 sci channel 0 ? * 6 to 4 2 to 0 correspondence between interrupt sources and ipr settin g s note: * reserved bits. bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 985 of 1108 rej09b0089-0700 abwcr?bus width control register h'fed0 bus controller 7 abw7 1 r/w 0 r/w 6 abw6 1 r/w 0 r/w 5 abw5 1 r/w 0 r/w 4 abw4 1 r/w 0 r/w 3 abw3 1 r/w 0 r/w 0 abw0 1 r/w 0 r/w 2 abw2 1 r/w 0 r/w 1 abw1 1 r/w 0 r/w bit modes 5 to 7 * initial value r/w mode 4 initial value read/write : : : : : area 7 to 0 bus width control note: * modes 6 and 7 cannot be used in the romless versions. 0 1 area n is desi g nated for 16-bit access area n is desi g nated for 8-bit access (n = 7 to 0) astcr?access state control re gister h'fed1 bus controller 7 as t 7 1 r / w 6 as t 6 1 r / w 5 as t 5 1 r / w 4 as t4 1 r / w 3 as t 3 1 r / w 0 as t 0 1 r / w 2 as t 2 1 r / w 1 as t 1 1 r / w b i t i n i t i a l va l ue read / wr i te : : : area 7 to 0 access state contro l 0 1 area n i s des ig nated for 2 - state access wa i t state i nsert i on i n area n externa l space i s d i sab l ed area n i s des ig nated for 3 - state access wa i t state i nsert i on i n area n externa l space i s enab l ed (n = 7 to 0)
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 986 of 1108 rej09b0089-0700 wcrh?wait control register h h'fed2 bus controller 7 w71 1 r / w 6 w70 1 r / w 5 w61 1 r / w 4 w60 1 r / w 3 w51 1 r / w 0 w 4 0 1 r / w 2 w50 1 r / w 1 w 4 1 1 r / w b i t i n i t i a l va l ue read / wr i te : : : area 7 wa i t contro l area 6 wa i t contro l area 5 wa i t contro l area 4 wa i t contro l 0 1 0 1 0 1 pro g ram wa i t not i nserted 1 pro g ram wa i t state i nserted 2 pro g ram wa i t states i nserted 3 pro g ram wa i t states i nserted 0 1 0 1 0 1 pro g ram wa i t not i nserted 1 pro g ram wa i t state i nserted 2 pro g ram wa i t states i nserted 3 pro g ram wa i t states i nserted 0 1 0 1 0 1 pro g ram wa i t not i nserted 1 pro g ram wa i t state i nserted 2 pro g ram wa i t states i nserted 3 pro g ram wa i t states i nserted 0 1 0 1 0 1 pro g ram wa i t not i nserted 1 pro g ram wa i t state i nserted 2 pro g ram wa i t states i nserted 3 pro g ram wa i t states i nserted
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 987 of 1108 rej09b0089-0700 wcrl?wait control register l h'fed3 bus controller 7 w31 1 r/w 6 w30 1 r/w 5 w21 1 r/w 4 w20 1 r/w 3 w11 1 r/w 0 w00 1 r/w 2 w10 1 r/w 1 w01 1 r/w bit initial value read/write : : : area 3 wait control area 2 wait control area 1 wait control area 0 wait control 0 1 0 1 0 1 pro g ram wait not inserted 1 pro g ram wait state inserted 2 pro g ram wait states inserted 3 pro g ram wait states inserted 0 1 0 1 0 1 pro g ram wait not inserted 1 pro g ram wait state inserted 2 pro g ram wait states inserted 3 pro g ram wait states inserted 0 1 0 1 0 1 pro g ram wait not inserted 1 pro g ram wait state inserted 2 pro g ram wait states inserted 3 pro g ram wait states inserted 0 1 0 1 0 1 pro g ram wait not inserted 1 pro g ram wait state inserted 2 pro g ram wait states inserted 3 pro g ram wait states inserted
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 988 of 1108 rej09b0089-0700 bcrh?bus control register h h'fed4 bus controller 7 icis1 1 r/w 6 icis0 1 r/w 5 brstrm 0 r/w 4 brsts1 1 r/w 3 brsts0 0 r/w 0 ? 0 r/w 2 ? 0 r/w 1 ? 0 r/w bit initial value read/write : : : idle cycle insert 1 0 1 idle cycle not inserted in case of successive external read cycles in different areas idle cycle inserted in case of successive external read cycles in different areas idle cycle insert 0 0 1 idle cycle not inserted in case of successive external read and external write cycles idle cycle inserted in case of successive external read and external write cycles area 0 burst rom enable 0 1 basic bus interface burst rom interface burst cycle select 1 0 1 burst cycle comprises 1 state burst cycle comprises 2 states burst cycle select 0 0 1 max. 4 words in burst access max. 8 words in burst access reserved only 0 should be written to these bits
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 989 of 1108 rej09b0089-0700 bcrl?bus control register l h'fed5 bus controller 7 brle 0 r/w 6 breqoe 0 r/w 5 eae 1 r/w 4 ? 1 r/w 3 ? 1 r/w 0 waite 0 r/w 2 ? 1 r/w 1 ? 0 r/w bit initial value read/write : : : bus release enable 0 1 external bus release disabled external bus release enabled breqo pin enable 0 1 breqo output disabled breqo output enabled 0 1 addresses h'010000 to h'03ffff * 2 : ? h8s/2319, h8s/2319c, h8s/2315, and h8s/2314: on-chip rom ? h8s/2318: on-chip rom ? h8s/2317, h8s/2317s: on-chip rom at addresses h'010000 to h'01ffff and reserved area * 1 at addresses h'020000 to h'03ffff ? h8s/2316s: reserved area * 1 addresses h'010000 to h'03ffff * 2 : ? expanded mode: external addresses ? single-chip mode: reserved area * 1 external address enable reserved only 0 should be written to this bit. wait pin enable 0 1 wait input by wait pin disabled wait input by wait pin enabled notes: 1. do not access a reserved area. 2. h'010000 to h'03ffff in the h8s/2318, h'010000 to h'05ffff in the h8s/2315 and h8s/2314, and h'010000 to h'07ffff in the h8s/2319 and h8s/2319c. reserved only 1 should be written to these bits.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 990 of 1108 rej09b0089-0700 ramer?ram emulation register h'fedb flash memory (valid only in f-ztat versions * ) 7 ? 0 ? 6 ? 0 ? 5 ? 0 ? 4 ? 0 ? 3 rams 0 r/w 0 ram0 0 r/w 2 ram2 0 r/w 1 ram1 0 r/w bit initial value read/write : : : ram2 0 1 rams 0 1 ram select, flash memory area select ram1 0 1 0 1 ram0 0 1 0 1 0 1 0 1 ram area block name : don't care h'ffdc00 to h'ffebff h'000000 to h'000fff h'001000 to h'001fff h'002000 to h'002fff h'003000 to h'003fff h'004000 to h'004fff h'005000 to h'005fff h'006000 to h'006fff h'007000 to h'007fff ram area, 4 kbytes eb0 (4 kbytes) eb1 (4 kbytes) eb2 (4 kbytes) eb3 (4 kbytes) eb4 (4 kbytes) eb5 (4 kbytes) eb6 (4 kbytes) eb7 (4 kbytes) note: * in the h8s/2314 f-ztat, this cannot be used and must not be accessed.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 991 of 1108 rej09b0089-0700 iscrh?irq sense control regist er h h'ff2c interrupt controller iscrl?irq sense control regist er l h'ff2d interrupt controller 15 irq7scb 0 r/w 14 irq7sca 0 r/w 13 irq6scb 0 r/w 12 irq6sca 0 r/w 11 irq5scb 0 r/w 8 irq4sca 0 r/w 10 irq5sca 0 r/w 9 irq4scb 0 r/w bit initial value read/write : : : iscrh 7 irq3scb 0 r/w 6 irq3sca 0 r/w 5 irq2scb 0 r/w 4 irq2sca 0 r/w 3 irq1scb 0 r/w 0 irq0sca 0 r/w 2 irq1sca 0 r/w 1 irq0scb 0 r/w irq7 to irq4 sense control a, b irq3 to irq0 sense control a, b 0 1 0 1 0 1 irqn input low level fallin g ed g e of irqn input risin g ed g e of irqn input both fallin g and risin g ed g es of irqn input irqnscb irqnsca interrupt request g eneration (n = 7 to 0) bit initial value read/write : : : iscrl
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 992 of 1108 rej09b0089-0700 ier?irq enable register h'ff2e interrupt controller 7 irq7e 0 r/w 6 irq6e 0 r/w 5 irq5e 0 r/w 4 irq4e 0 r/w 3 irq3e 0 r/w 0 irq0e 0 r/w 2 irq2e 0 r/w 1 irq1e 0 r/w irqn enable 0 1 irqn interrupt disabled irqn interrupt enabled (n = 7 to 0) bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 993 of 1108 rej09b0089-0700 isr?irq status register h'ff2f interrupt controller 7 irq7f 0 r/(w) * 6 irq6f 0 r/(w) * 5 irq5f 0 r/(w) * 4 irq4f 0 r/(w) * 3 irq3f 0 r/(w) * 0 irq0f 0 r/(w) * 2 irq2f 0 r/(w) * 1 irq1f 0 r/(w) * bit initial value read/write : : : indicate the status of irq7 to irq0 interrupt requests bit n irqnf description 0 [clearing conditions] (initial value) ? when 0 is written to irqnf after reading irqnf = 1 ? when interrupt exception handling is executed while low-level detection is set (irqnscb = irqnsca = 0) and irqn input is high ? when irqn interrupt exception handling is executed while falling, rising, or both- edge detection is set (irqnscb = 1 or irqnsca = 1) ? when the dtc is activated by an irqn interrupt and the disel bit in the dtc's mrb register is 0 1 [setting conditions] ? when irqn input goes low while low-level detection is set (irqnscb = irqnsca = 0) ? when a falling edge occurs in irqn input while falling edge detection is set (irqnscb = 0, irqnsca = 1) ? when a rising edge occurs in irqn input while rising edge detection is set (irqnscb = 1, irqnsca = 0) ? when a falling or rising edge occurs in irqn input while both-edge detection is set (irqnscb = irqnsca = 1) (n = 7 to 0) note: * can only be written with 0 for flag clearing.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 994 of 1108 rej09b0089-0700 dtcera to dtcerf?dtc enable registers h'ff30 to h'ff34 dtc 7 dtce7 0 r/w 6 dtce6 0 r/w 5 dtce5 0 r/w 4 dtce4 0 r/w 3 dtce3 0 r/w 0 dtce0 0 r/w 2 dtce2 0 r/w 1 dtce1 0 r/w dtc activation enable bit initial value read/write : : : dtc activation by this interrupt is disabled [clearin g conditions] ? when the disel bit is 1 and data transfer has ended ? when the specified number of transfers have ended 0 1 dtc activation by this interrupt is enabled [holdin g condition] when the disel bit is 0 and the specified number of transfers have not ended correspondence between int errupt sources and dtcer bits register 7 6 5 4 3 2 1 0 dtcera irq0 irq1 irq2 irq3 irq4 irq5 irq6 irq7 dtcerb ? adi tgi0a tgi0b tgi0c tgi0d tgi1a tgi1b dtcerc tgi2a tgi2b tgi3a tgi3b tgi3c tgi3d tgi4a tgi4b dtcerd ? ? tgi5a tgi5b cmia0 cmib0 cmia1 cmib1 dtcere ? ? ? ? rxi0 txi0 rxi1 txi1 note: for dtce bit setting, read/write operations must be performed using bit-manipulation instructions such as bset and bclr. for the initial setting only, however, when multiple activation sources are set at one time, it is possible to disable interrupts and write after executing a dummy read on the relevant register.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 995 of 1108 rej09b0089-0700 dtvecr?dtc vector register h'ff37 dtc 7 swdte 0 r/w 6 dtvec6 0 r/(w) * 5 dtvec5 0 r/(w) * 4 dtvec4 0 r/(w) * 3 dtvec3 0 r/(w) * 0 dtvec0 0 r/(w) * 2 dtvec2 0 r/(w) * 1 dtvec1 0 r/(w) * dtc software activation enable 0 1 dtc software activation is enabled [holdin g conditions] ? when the disel bit is 1 and data transfer has ended ? when the specified number of transfers have ended ? durin g data transfer due to software activation sets vector number for dtc software activation bit initial value read/write : : : note: * bits dtvec6 to dtvec0 can be written to when swdte = 0. dtc software activation is disabled [clearin g conditions] ? when the disel bit is 0 and the specified number of transfers have not ended ? when 0 is written to the swdte bit after a software activated data transfer end interrupt (swdtend) has been requested of the cpu
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 996 of 1108 rej09b0089-0700 sbycr?standby control register h'ff38 power-down state 7 ssby 0 r/w 6 sts2 0 r/w 5 sts1 0 r/w 4 sts0 0 r/w 3 ope 1 r/w 0 irq37s 0 r/w 2 ? 0 ? 1 ? 0 ? software standby note: * cannot be used in the f-ztat versions. 0 1 transition to sleep mode after execution of sleep instruction transition to software standby mode after execution of sleep instruction standby timer select 0 1 0 1 0 1 0 1 0 1 0 1 0 1 standby time = 8192 states standby time = 16384 states standby time = 32768 states standby time = 65536 states standby time = 131072 states standby time = 262144 states reserved standby time = 16 states * output port enable bit initial value read/write : : : irq37 software standby clear select 0 1 irq3 to irq7 cannot be used as software standby mode clearin g sources irq3 to irq7 can be used as software standby mode clearin g sources 0 1 in software standby mode, address bus and bus control si g nals are hi g h-impedance in software standby mode, address bus and bus control si g nals retain output state
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 997 of 1108 rej09b0089-0700 syscr?system control register h'ff39 mcu 7 ? 0 r/w 6 ? 0 ? 5 intm1 0 r/w 4 intm0 0 r/w 3 nmie g 0 r/w 0 rame 1 r/w 2 lwrod 0 r/w 1 ? 0 r/w bit initial value read/write : : : reserved only 0 should be written to this bit ram enable 0 on-chip ram disabled 1 on-chip ram enabled nmi input ed g e select 0 fallin g ed g e 1 risin g ed g e interrupt control mode selection 0 1 interrupt control mode 0 0 1 0 1 settin g prohibited interrupt control mode 2 settin g prohibited lwr output disable 0 pf3 is desi g nated as lwr output pin 1 pf3 is desi g nated as i/o port, and does not function as lwr output pin reserved only 0 should be written to this bit
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 998 of 1108 rej09b0089-0700 sckcr?system clock control register h'ff3a clock pulse generator 7 pstop 0 r/w 6 ? 0 r/w 5 div 0 r/w 4 ? 0 ? 3 ? 0 ? 0 sck0 0 r/w 2 sck2 0 r/w 1 sck1 0 r/w 0 1 pstop normal operation output fixed hi g h hi g h impedance hi g h impedance fixed hi g h fixed hi g h clock output control system clock select division ratio select reserved only 0 should be written to this bit 0 1 0 1 0 1 0 1 0 1 0 1 ? bus master is in hi g h-speed mode medium-speed clock is /2 medium-speed clock is /4 medium-speed clock is /8 medium-speed clock is /16 medium-speed clock is /32 ? bus master is in hi g h-speed mode clock supplied to entire chip is /2 clock supplied to entire chip is /4 clock supplied to entire chip is /8 ? ? ? output fixed hi g h sleep mode bit initial value read/write : : : software standby mode hardware standby mode div = 0 div = 1
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 999 of 1108 rej09b0089-0700 mdcr?mode control register h'ff3b mcu 7 ? 1 ? 6 ? 0 ? 5 ? 0 ? 4 ? 0 ? 3 ? 0 ? 0 mds0 ? * r 2 mds2 ? * r 1 mds1 ? * r current mode pin operatin g mode bit initial value read/write : : : note: * determined by pins md2 to md0 mstpcrh?module stop control register h h'ff3c power-down state mstpcrl?module stop control register l h'ff3d power-down state 15 0 r/w 14 0 r/w 13 1 r/w 12 1 r/w 11 1 r/w 10 1 r/w 9 1 r/w 8 1 r/w 7 1 r/w 6 1 r/w 5 1 r/w 4 1 r/w 3 1 r/w 2 1 r/w 1 1 r/w 0 1 r/w mstpcrh mstpcrl specifies module stop mode mstp bits and on-chip supportin g modules 0 1 module stop mode cleared module stop mode set re g ister mstpcrh mstpcrl bits mstp15 mstp14 mstp13 mstp12 mstp11 mstp10 mstp9 mstp8 mstp7 mstp6 mstp5 mstp4 mstp3 mstp2 mstp1 mstp0 module ? dtc tpu 8-bit timer ? d/a a/d ? ? sci1 sci0 ? ? ? ? ? bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1000 of 1108 rej09b0089-0700 syscr2?system control register 2 h'ff42 flash memory (valid only in f-ztat versions) 7 ? 0 ? 6 ? 0 ? 5 ? 0 ? 4 ? 0 ? 3 flshe 0 r/w 0 ? 0 ? (r/w) 2 ? 0 ? 1 ? 0 ? bit initial value read/write : : : 0 1 flash memory control re g ister enable in the h8s/2319 and h8s/2319c, this bit is reserved and should be written with 0. h8s/2319 f-ztat, h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat ? flash control re g isters are not selected for addresses h'ffffc8 to h'ffffcb h8s/2319c f-ztat ? flash control re g isters are not selected for addresses h'ffffc4 to h'ffffcf h8s/2319 f-ztat, h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat ? flash control re g isters are selected for addresses h'ffffc8 to h'ffffcb h8s/2319c f-ztat ? flash control re g isters are selected for addresses h'ffffc4 to h'ffffcf reserved register h'ff44 7 ? 0 ? 6 ? 0 ? 5 ? 0 r/w 4 ? 0 ? 3 ? 0 ? 0 ? 0 ? 2 ? 0 ? 1 ? 0 ? reserved only 0 should be written to these bits bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1001 of 1108 rej09b0089-0700 pfcr1?port function control register 1 h'ff45 port 7 css17 0 r/w 6 css36 0 r/w 5 pf1cs5s 0 r/w 4 pf0cs4s 0 r/w 3 a23e 1 r/w 0 a20e 1 r/w 2 a22e 1 r/w 1 a21e 1 r/w bit initial value read/write : : : 0 1 p10dr is output when p10ddr = 1 a20 is output when p10ddr = 1 address 20 output enable * 1 0 1 p11dr is output when p11ddr = 1 a21 is output when p11ddr = 1 address 21 output enable * 1 0 1 p12dr is output when p12ddr = 1 a22 is output when p12ddr = 1 address 22 output enable * 1 0 1 pf0 is pf0/ breq / irq0 pin pf0 is pf0/ breq / irq0 / cs4 pin. cs4 output is enabled when brle = 0, cs25e = 1, and pf0ddr = 1 port f0 chip select 4 select * 1 0 1 pf1 is pf1/ back / irq1 pin pf1 is pf1/ back / irq1 / cs5 pin. cs5 output is enabled when brle = 0, cs25e = 1, and pf1ddr = 1 port f1 chip select 5 select * 1 0 1 p g 1 is p g 1/ irq7 / cs3 pin. cs3 output is enabled when when cs25e = 1 and p g 1ddr = 1 p g 1 is p g 1/ irq7 / cs6 pin. cs6 output is enabled when cs167e = 1 and p g 1ddr = 1 cs36 select * 1 * 3 0 1 p g 3 is p g 3/ cs1 pin. cs1 output is enabled when cs167e = 1 and p g 3ddr = 1 p g 3 is p g 3/ cs7 pin. cs7 output is enabled when cs167e = 1 and p g 3ddr = 1 cs17 select * 1 * 2 notes: 1. valid in modes 4 to 6. 2. clear p g 3ddr to 0 before chan g in g the css17 bit settin g . 3. clear p g 1ddr to 0 before chan g in g the css36 bit settin g . 0 1 p13dr is output when p13ddr = 1 a23 is output when p13ddr = 1 address 23 output enable * 1
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1002 of 1108 rej09b0089-0700 port1?port 1 register h'ff50 port 1 7 p17 ? * r 6 p16 ? * r 5 p15 ? * r 4 p14 ? * r 3 p13 ? * r 0 p10 ? * r 2 p12 ? * r 1 p11 ? * r note: * determined by the state of pins p17 to p10. state of port 1 pins bit initial value read/write : : : port2?port 2 register h'ff51 port 2 7 p27 ? * r 6 p26 ? * r 5 p25 ? * r 4 p24 ? * r 3 p23 ? * r 0 p20 ? * r 2 p22 ? * r 1 p21 ? * r state of port 2 pins note: * determined by the state of pins p27 to p20. bit initial value read/write : : : port3?port 3 register h'ff52 port 3 7 ? undefined ? 6 ? undefined ? 5 p35 ? * r 4 p34 ? * r 3 p33 ? * r 0 p30 ? * r 2 p32 ? * r 1 p31 ? * r state of port 3 pins note: * determined by the state of pins p35 to p30. bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1003 of 1108 rej09b0089-0700 port4?port 4 register h'ff53 port 4 7 p47 ? * r 6 p46 ? * r 5 p45 ? * r 4 p44 ? * r 3 p43 ? * r 0 p40 ? * r 2 p42 ? * r 1 p41 ? * r state of port 4 pins note: * determined by the state of pins p47 to p40. bit initial value read/write : : : porta?port a register h'ff59 port a 7 ? undefined ? 6 ? undefined ? 5 ? undefined ? 4 ? undefined ? 3 pa3 ? * r 0 pa0 ? * r 2 pa2 ? * r 1 pa1 ? * r state of port a pins note: * determined by the state of pins pa3 to pa0. bit initial value read/write : : : portb?port b register h'ff5a port b 7 pb7 ? * r 6 pb6 ? * r 5 pb5 ? * r 4 pb4 ? * r 3 pb3 ? * r 0 pb0 ? * r 2 pb2 ? * r 1 pb1 ? * r state of port b pins note: * determined by the state of pins pb7 to pb0. bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1004 of 1108 rej09b0089-0700 portc?port c register h'ff5b port c 7 pc7 ? * r 6 pc6 ? * r 5 pc5 ? * r 4 pc4 ? * r 3 pc3 ? * r 0 pc0 ? * r 2 pc2 ? * r 1 pc1 ? * r state of port c pins note: * determined by the state of pins pc7 to pc0. bit initial value read/write : : : portd?port d register h'ff5c port d 7 pd7 ? * r 6 pd6 ? * r 5 pd5 ? * r 4 pd4 ? * r 3 pd3 ? * r 0 pd0 ? * r 2 pd2 ? * r 1 pd1 ? * r state of port d pins note: * determined by the state of pins pd7 to pd0. bit initial value read/write : : : porte?port e register h'ff5d port e 7 pe7 ? * r 6 pe6 ? * r 5 pe5 ? * r 4 pe4 ? * r 3 pe3 ? * r 0 pe0 ? * r 2 pe2 ? * r 1 pe1 ? * r state of port e pins note: * determined by the state of pins pe7 to pe0. bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1005 of 1108 rej09b0089-0700 portf?port f register h'ff5e port f 7 pf7 ? * r 6 pf6 ? * r 5 pf5 ? * r 4 pf4 ? * r 3 pf3 ? * r 0 pf0 ? * r 2 pf2 ? * r 1 pf1 ? * r state of port f pins note: * determined by the state of pins pf7 to pf0. bit initial value read/write : : : portg?port g register h'ff5f port g 7 ? undefined ? 6 ? undefined ? 5 ? undefined ? 4 p g 4 ? * r 3 p g 3 ? * r 0 p g 0 ? * r 2 p g 2 ? * r 1 p g 1 ? * r state of port g pins note: * determined by the state of pins p g 4 to p g 0. bit initial value read/write : : : p1dr?port 1 data register h'ff60 port 1 7 p17dr 0 r/w 6 p16dr 0 r/w 5 p15dr 0 r/w 4 p14dr 0 r/w 3 p13dr 0 r/w 0 p10dr 0 r/w 2 p12dr 0 r/w 1 p11dr 0 r/w stores output data for port 1 pins (p17 to p10) bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1006 of 1108 rej09b0089-0700 p2dr?port 2 data register h'ff61 port 2 7 p27dr 0 r/w 6 p26dr 0 r/w 5 p25dr 0 r/w 4 p24dr 0 r/w 3 p23dr 0 r/w 0 p20dr 0 r/w 2 p22dr 0 r/w 1 p21dr 0 r/w stores output data for port 2 pins (p27 to p20) bit initial value read/write : : : p3dr?port 3 data register h'ff62 port 3 7 ? undefined ? 6 ? undefined ? 5 p35dr 0 r/w 4 p34dr 0 r/w 3 p33dr 0 r/w 0 p30dr 0 r/w 2 p32dr 0 r/w 1 p31dr 0 r/w stores output data for port 3 pins (p35 to p30) bit initial value read/write : : : padr?port a data register h'ff69 port a 7 ? undefined ? 6 ? undefined ? 5 ? undefined ? 4 ? undefined ? 3 pa3dr 0 r/w 0 pa0dr 0 r/w 2 pa2dr 0 r/w 1 pa1dr 0 r/w stores output data for port a pins (pa3 to pa0) bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1007 of 1108 rej09b0089-0700 pbdr?port b data register h'ff6a port b 7 pb7dr 0 r/w 6 pb6dr 0 r/w 5 pb5dr 0 r/w 4 pb4dr 0 r/w 3 pb3dr 0 r/w 0 pb0dr 0 r/w 2 pb2dr 0 r/w 1 pb1dr 0 r/w stores output data for port b pins (pb7 to pb0) bit initial value read/write : : : pcdr?port c data register h'ff6b port c 7 pc7dr 0 r/w 6 pc6dr 0 r/w 5 pc5dr 0 r/w 4 pc4dr 0 r/w 3 pc3dr 0 r/w 0 pc0dr 0 r/w 2 pc2dr 0 r/w 1 pc1dr 0 r/w stores output data for port c pins (pc7 to pc0) bit initial value read/write : : : pddr?port d data register h'ff6c port d 7 pd7dr 0 r/w 6 pd6dr 0 r/w 5 pd5dr 0 r/w 4 pd4dr 0 r/w 3 pd3dr 0 r/w 0 pd0dr 0 r/w 2 pd2dr 0 r/w 1 pd1dr 0 r/w stores output data for port d pins (pd7 to pd0) bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1008 of 1108 rej09b0089-0700 pedr?port e data register h'ff6d port e 7 pe7dr 0 r/w 6 pe6dr 0 r/w 5 pe5dr 0 r/w 4 pe4dr 0 r/w 3 pe3dr 0 r/w 0 pe0dr 0 r/w 2 pe2dr 0 r/w 1 pe1dr 0 r/w stores output data for port e pins (pe7 to pe0) bit initial value read/write : : : pfdr?port f data register h'ff6e port f 7 pf7dr 0 r/w 6 pf6dr 0 r/w 5 pf5dr 0 r/w 4 pf4dr 0 r/w 3 pf3dr 0 r/w 0 pf0dr 0 r/w 2 pf2dr 0 r/w 1 pf1dr 0 r/w stores output data for port f pins (pf7 to pf0) bit initial value read/write : : : pgdr?port g data register h'ff6f port g 7 ? undefined ? 6 ? undefined ? 5 ? undefined ? 4 p g 4dr 0 r/w 3 p g 3dr 0 r/w 0 p g 0dr 0 r/w 2 p g 2dr 0 r/w 1 p g 1dr 0 r/w stores output data for port g pins (p g 4 to p g 0) bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1009 of 1108 rej09b0089-0700 papcr?port a mos pull-up control register h'ff70 port a 7 ? undefined ? 6 ? undefined ? 5 ? undefined ? 4 ? undefined ? 3 pa3pcr 0 r/w 0 pa0pcr 0 r/w 2 pa2pcr 0 r/w 1 pa1pcr 0 r/w controls the mos input pull-up function incorporated into port a on a bit-by-bit basis bit initial value read/write : : : pbpcr?port b mos pull-up co ntrol register h'ff71 port b 7 pb7pcr 0 r/w 6 pb6pcr 0 r/w 5 pb5pcr 0 r/w 4 pb4pcr 0 r/w 3 pb3pcr 0 r/w 0 pb0pcr 0 r/w 2 pb2pcr 0 r/w 1 pb1pcr 0 r/w controls the mos input pull-up function incorporated into port b on a bit-by-bit basis bit initial value read/write : : : pcpcr?port c mos pull-up control register h'ff72 port c 7 pc7pcr 0 r/w 6 pc6pcr 0 r/w 5 pc5pcr 0 r/w 4 pc4pcr 0 r/w 3 pc3pcr 0 r/w 0 pc0pcr 0 r/w 2 pc2pcr 0 r/w 1 pc1pcr 0 r/w controls the mos input pull-up function incorporated into port c on a bit-by-bit basi s bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1010 of 1108 rej09b0089-0700 pdpcr?port d mos pull-up control register h'ff73 port d 7 pd7pcr 0 r/w 6 pd6pcr 0 r/w 5 pd5pcr 0 r/w 4 pd4pcr 0 r/w 3 pd3pcr 0 r/w 0 pd0pcr 0 r/w 2 pd2pcr 0 r/w 1 pd1pcr 0 r/w controls the mos input pull-up function incorporated into port d on a bit-by-bit basi s bit initial value read/write : : : pepcr?port e mos pull-up co ntrol register h'ff74 port e 7 pe7pcr 0 r/w 6 pe6pcr 0 r/w 5 pe5pcr 0 r/w 4 pe4pcr 0 r/w 3 pe3pcr 0 r/w 0 pe0pcr 0 r/w 2 pe2pcr 0 r/w 1 pe1pcr 0 r/w controls the mos input pull-up function incorporated into port e on a bit-by-bit basis bit initial value read/write : : : p3odr?port 3 open drain cont rol register h'ff76 port 3 7 ? undefined ? 6 ? undefined ? 5 p35odr 0 r/w 4 p34odr 0 r/w 3 p33odr 0 r/w 0 p30odr 0 r/w 2 p32odr 0 r/w 1 p31odr 0 r/w controls the pmos on/off status for each port 3 pin (p35 to p30) bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1011 of 1108 rej09b0089-0700 paodr?port a open drain control register h'ff77 port a 7 ? undefined ? 6 ? undefined ? 5 ? undefined ? 4 ? undefined ? 3 pa3odr 0 r/w 0 pa0odr 0 r/w 2 pa2odr 0 r/w 1 pa1odr 0 r/w controls the pmos on/off status for each port a pin (pa3 to pa0) bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1012 of 1108 rej09b0089-0700 smr0?serial mode register 0 h'ff78 sci0 7 c/ a 0 r/w 6 chr 0 r/w 5 pe 0 r/w 4 o/ e 0 r/w 3 stop 0 r/w 0 cks0 0 r/w 2 mp 0 r/w 1 cks1 0 r/w 0 1 asynchronous mode synchronous mode asynchronous mode/synchronous mode select 0 1 parity bit addition and checkin g disabled parity bit addition and checkin g enabled * parity enable 0 1 even parity * 1 odd parity * 2 parity mode 0 1 multiprocessor function disabled multiprocessor format selected 1. when even parity is selected, the parity bit added to transmit data makes an even number of 1s in the transmitted character and parity bit combined. receive data must have an even number of 1s in the received character and parity bit combined. 2. when odd parity is selected, the parity bit added to transmit data makes an odd number of 1s in the transmitted character and parity bit combined. receive data must have an odd number of 1s in the received character and parity bit combined. multiprocessor mode 0 1 1 stop bit 2 stop bits stop bit len g th notes: * when the pe bit is set to 1, the parity (even or odd) specified by the o/ e bit is added to transmit data before transmission. in reception, the parity bit is checked for the parity (even or odd) specified by the o/ e bit. note: 0 1 0 1 0 1 clock /4 clock /16 clock /64 clock clock select 0 1 8-bit data 7-bit data * character len g th bit initial value read/write : : : note: * when 7-bit data is selected, the msb (bit 7) of tdr is not transmitted. with 7-bit data, it is not possible to select lsb-first or msb-first transfer.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1013 of 1108 rej09b0089-0700 smr0?serial mode register 0 h'ff78 smart card interface 0 7 g m 0 r/w 6 blk 0 r/w 5 pe 0 r/w 4 o/ e 0 r/w 3 bcp1 0 r/w 0 cks0 0 r/w 2 bcp0 0 r/w 1 cks1 0 r/w 0 1 normal smart card interface mode operation tend fla g g enerated 12.5 etu (11.5 etu in block transfer mode) after be g innin g of start bit clock output on/off control only g sm mode smart card interface mode operation tend fla g g enerated 11.0 etu after be g innin g of start bit fixed hi g h/low-level control possible (set in scr) in addition to clock output on/off control g sm mode 0 1 settin g prohibited parity bit addition and checkin g enabled parity enable (set to 1 when usin g the smart card interface) 0 1 even parity * 1 odd parity * 2 parity mode 0 1 0 1 0 1 clock /4 clock /16 clock /64 clock clock select bit initial value read/write : : : note: etu (elementary time unit): time for transfer of 1 bit 0 1 0 1 0 1 32 clocks 64 clocks 372 clocks 256 clocks base clock pulse bcp1 bcp0 base clock pulse 0 1 normal smart card interface mode block transfer mode block transfer mode select 1. when even parity is selected, the parity bit added to transmit data makes an even number of 1s in the transmitted character and parity bit combined. receive data must have an even number of 1s in the received character and parity bit combined. 2. when odd parity is selected, the parity bit added to transmit data makes an odd number of 1s in the transmitted character and parity bit combined. receive data must have an odd number of 1s in the received character and parity bit combined. notes:
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1014 of 1108 rej09b0089-0700 brr0?bit rate register 0 h'ff79 sci0, smart card interface 0 7 1 r/w 6 1 r/w 5 1 r/w 4 1 r/w 3 1 r/w 0 1 r/w 2 1 r/w 1 1 r/w sets the serial transfer bit rate note: for details, see section 12.2.8, bit rate re g ister (brr). bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1015 of 1108 rej09b0089-0700 scr0?serial control register 0 h'ff7a sci0 7 tie 0 r/w 6 rie 0 r/w 5 te 0 r/w 4 re 0 r/w 3 mpie 0 r/w 0 cke0 0 r/w 2 teie 0 r/w 1 cke1 0 r/w 1 0 asynchronous mode internal clock/sck pin functions as i/o port clock enable 0 1 transmit-end interrupt (tei) request disabled * transmit-end interrupt (tei) request enabled * transmit end interrupt enable 0 multiprocessor interrupts disabled [clearin g conditions] when the mpie bit is cleared to 0 when data with mpb = 1 is received multiprocessor interrupt enable 0 1 reception disabled * 1 reception enabled * 2 receive enable 0 1 transmission disabled * 1 transmission enabled * 2 transmit enable 0 receive-data-full interrupt (rxi) request and receive-error interrupt (eri) request disabled * receive interrupt enable 0 1 transmit-data-empty interrupt (txi) request disabled * transmit-data-empty interrupt (txi) request enabled transmit interrupt enable bit initial value read/write : : : synchronous mode internal clock/sck pin functions as serial clock output asynchronous mode internal clock/sck pin functions as clock output * 1 synchronous mode internal clock/sck pin functions as serial clock output asynchronous mode external clock/sck pin functions as clock input * 2 synchronous mode external clock/sck pin functions as serial clock input asynchronous mode external clock/sck pin functions as clock input * 2 synchronous mode external clock/sck pin functions as serial clock input multiprocessor interrupts enabled * receive-data-full interrupt (rxi) requests, receive-error interrupt (eri) requests, and settin g of the rdrf, fer, and orer fla g s in ssr are disabled until data with the multiprocessor bit set to 1 is received 1 1 receive-data-full interrupt (rxi) request and receive-error interrupt (eri) request enabled 1 0 1 0 notes: 1. outputs a clock of the same frequency as the bit rate. 2. inputs a clock with a frequency 16 times the bit rate. notes: 1. clearin g the re bit to 0 does not affect the rdrf, fer, per, and orer fla g s, which retain their states. 2. serial reception is started in this state when a start bit is detected in asynchronous mode or serial clock input is detected in synchronous mode. smr settin g must be performed to decide the receive format before settin g the re bit to 1. notes: 1. the tdre fla g in ssr is fixed at 1. 2. in this state, serial transmission is started when transmit data is written to tdr and the tdre fla g in ssr is cleared to 0. smr settin g must be performed to decide the transmit format before settin g the te bit to 1. note: * tei clearin g can be performed by readin g 1 from the tdre fla g in ssr, then clearin g it to 0 and clearin g the tend fla g to 0, or by clearin g the teie bit to 0. note: * when receive data includin g mpb = 0 is received, receive data transfer from rsr to rdr, receive error detection, and settin g of the rdrf, fer, and orer fla g s in ssr, is not performed. when receive data includin g mpb = 1 is received, the mpb bit in ssr is set to 1, the mpie bit is cleared to 0 automatically, and g eneration of rxi and eri interrupts (when the tie and rie bits in scr are set to 1) and fer and orer fla g settin g is enabled. note: * rxi and eri interrupt requests can be cleared by readin g 1 from the rdrf, fer, per, or orer fla g , then clearin g the fla g to 0, or by clearin g the rie bit to 0. note: * txi interrupt requests can be cleared by readin g 1 from the tdre fla g , then clearin g it to 0, or by clearin g the tie bit to 0.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1016 of 1108 rej09b0089-0700 scr0?serial control register 0 h'ff7a smart card interface 0 7 tie 0 r/w 6 rie 0 r/w 5 te 0 r/w 4 re 0 r/w 3 mpie 0 r/w 0 cke0 0 r/w 2 teie 0 r/w 1 cke1 0 r/w smcr smif 0 1 1 1 1 1 1 0 0 1 1 1 1 0 0 0 0 1 1 0 1 0 1 0 1 smr g m cke1 cke0 see sci specification sck pin function clock enable scr settin g 0 1 transmit-end interrupt (tei) request disabled * transmit-end interrupt (tei) request enabled * transmit end interrupt enable 0 multiprocessor interrupts disabled [clearin g conditions] when the mpie bit is cleared to 0 when data with mpb = 1 is received multiprocessor interrupt enable 0 1 reception disabled * 1 reception enabled * 2 receive enable 0 1 transmission disabled * 1 transmission enabled * 2 transmit enable 0 receive-data-full interrupt (rxi) request and receive-error interrupt (eri) request disabled * receive interrupt enable 0 1 transmit-data-empty interrupt (txi) request disabled * transmit-data-empty interrupt (txi) request enabled transmit interrupt enable bit initial value read/write : : : multiprocessor interrupts enabled * receive-data-full interrupt (rxi) requests, receive-error interrupt (eri) requests, and settin g of the rdrf, fer, and orer fla g s in ssr are disabled until data with the multiprocessor bit set to 1 is received 1 1 receive-data-full interrupt (rxi) request and receive-error interrupt (eri) request enabled operates as port i/o pin clock output as sck output pin fixed-low output as sck output pin clock output as sck output pin fixed-hi g h output as sck output pin clock output as sck output pin note: * tei clearin g can be performed by readin g 1 from the tdre fla g in ssr, then clearin g it to 0 and clearin g the tend fla g to 0, or by clearin g the teie bit to 0. note: * when receive data includin g mpb = 0 is received, receive data transfer from rsr to rdr, receive error detection, and settin g of the rdrf, fer, and orer fla g s in ssr, is not performed. when receive data includin g mpb = 1 is received, the mpb bit in ssr is set to 1, the mpie bit is cleared to 0 automatically, and g eneration of rxi and eri interrupts (when the tie and rie bits in scr are set to 1) and fer and orer fla g settin g is enabled. notes: 1. clearin g the re bit to 0 does not affect the rdrf, fer, per, and orer fla g s, which retain their states. 2. serial reception is started in this state when a start bit is detected in asynchronous mode or serial clock input is detected in synchronous mode. smr settin g must be performed to decide the receive format before settin g the re bit to 1. notes: 1. the tdre fla g in ssr is fixed at 1. 2. in this state, serial transmission is started when transmit data is written to tdr and the tdre fla g in ssr is cleared to 0. smr settin g must be performed to decide the transmit format before settin g the te bit to 1. note: * rxi and eri interrupt requests can be cleared by readin g 1 from the rdrf, fer, per, or orer fla g , then clearin g the fla g to 0, or by clearin g the rie bit to 0. note: * txi interrupt requests can be cleared by readin g 1 from the tdre fla g , then clearin g it to 0, or by clearin g the tie bit to 0.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1017 of 1108 rej09b0089-0700 tdr0?transmit data register 0 h'ff7 b sci0, smart card interface 0 7 1 r/w 6 1 r/w 5 1 r/w 4 1 r/w 3 1 r/w 0 1 r/w 2 1 r/w 1 1 r/w stores data for serial transmission bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1018 of 1108 rej09b0089-0700 ssr0?serial status register 0 h'ff7c sci0 [settin g condition] when serial reception ends normally and receive data is transferred from rsr to rdr 7 tdre 1 r/(w) * 6 rdrf 0 r/(w) * 5 orer 0 r/(w) * 4 fer 0 r/(w) * 3 per 0 r/(w) * 0 mpbt 0 r/w 2 tend 1 r 1 mpb 0 r 0 transmit data re g ister empty 0 receive data re g ister full * 0 overrun error 0 framin g error 0 parity error 0 transmit end [clearin g conditions] when 0 is written to tdre after readin g tdre = 1 when the dtc is activated by a txi interrupt and writes data to tdr 0 multiprocessor bit [clearin g condition] when data with a 0 multiprocessor bit is received * [settin g condition] when data with a 1 multiprocessor bit is received multiprocessor bit transfer 0 1 data with a 0 multiprocessor bit is transmitted data with a 1 multiprocessor bit is transmitted bit initial value read/write : : : [settin g conditions] when the te bit in scr is 0 when tdre = 1 at transmission of the last bit of a 1-byte serial transmit character [clearin g condition] when 0 is written to per after readin g per = 1 * 1 [settin g condition] when, in reception, the number of 1 bits in the receive data plus the parity bit does not match the parity settin g (even or odd) specified by the o/ e bit in smr * 2 [clearin g condition] when 0 is written to fer after readin g fer = 1 * 1 [settin g condition] when the sci checks the stop bit at the end of the receive data when reception ends, and the stop bit is 0 * 2 [clearin g condition] when 0 is written to orer after readin g orer = 1 * 1 [settin g condition] when the next serial reception is completed while rdrf = 1 * 2 [clearin g conditions] when 0 is written to rdrf after readin g rdrf = 1 when the dtc is activated by an rxi interrupt and reads data from rdr [clearin g conditions] when 0 is written to tdre after readin g tdre = 1 when the dtc is activated by a txi interrupt and writes data to tdr [settin g conditions] when the te bit in scr is 0 when data is transferred from tdr to tsr and data can be written to tdr 1 1 1 1 1 1 1 note: * retains its previous state when the re bit in scr is cleared to 0 with a multiprocessor format. note: * rdr and the rdrf fla g are not affected and retain their previous values when an error is detected durin g reception or when the re bit in scr is cleared to 0. if reception of the next data is completed while the rdrf fla g is still set to 1, an overrun error will occur and the receive data will be lost. notes: 1. the per fla g is not affected and retains its previous state when the re bit in scr is cleared to 0. 2. if a parity error occurs, the receive data is transferred to rdr but the rdrf fla g is not set. serial reception cannot be continued while the per fla g is set to 1. in synchronous mode, serial transmission is also disabled. notes: 1. the fer fla g is not affected and retains its previous state when the re bit in scr is cleared to 0. 2. in 2-stop-bit mode, only the first stop bit is checked for a value of 1; the second stop bit is not checked. if a framin g error occurs, the receive data is transferred to rdr but the rdrf fla g is not set. serial reception cannot be continued while the fer fla g is set to 1. in synchronous mode, serial transmission is also disabled. notes: 1. the orer fla g is not affected and retains its previous state when the re bit in scr is cleared to 0. 2. the receive data prior to the overrun error is retained in rdr, and data received subsequently is lost. serial reception cannot be continued while the orer fla g is set to 1. in synchronous mode, serial transmission is also disabled. note: * can only be written with 0 for fla g clearin g .
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1019 of 1108 rej09b0089-0700 ssr0?serial status register 0 h'ff7c smart card interface 0 7 t dr e 1 r / (w) * 6 rdr f 0 r / (w) * 5 or e r 0 r / (w) * 4 e rs 0 r / (w) * 3 p e r 0 r / (w) * 0 mpb t 0 r / w 2 ten d 1 r 1 mpb 0 r 0 t ransm i t data re gi ster e mpty 0 rece i ve data re gi ster f u ll * 0 overrun e rror 0 e rror s ig na l status * 0 par i ty e rror 0 t ransm i t e nd t ransm i ss i on i n pro g ress [ c l ear i n g cond i t i ons ] when 0 i s wr i tten to t dr e after read i n g t dr e = 1 when the d t c i s act i vated by a t x i i nterrupt and wr i tes data to t dr 0 mu l t i processor b i t [ c l ear i n g cond i t i on ] when data w i th a 0 mu l t i processor b i t i s rece i ved * [ sett i n g cond i t i on ] when data w i th a 1 mu l t i processor b i t i s rece i ved mu l t i processor b i t t ransfer 0 1 data w i th a 0 mu l t i processor b i t i s transm i tted data w i th a 1 mu l t i processor b i t i s transm i tted b i t i n i t i a l va l ue read / wr i te : : : t ransm i ss i on has ended [ sett i n g cond i t i ons ] on reset, or i n standby mode or modu l e stop mode when the te b i t i n scr i s 0 and the e rs b i t i s 0 when t dr e = 1 and e rs = 0 (norma l transm i ss i on) 2 . 5 etu after transm i ss i on of a 1 - byte ser i a l character when g m = 0 and b lk = 0 when t dr e = 1 and e rs = 0 (norma l transm i ss i on) 1 . 5 etu after transm i ss i on of a 1 - byte ser i a l character when g m = 0 and b lk = 1 when t dr e = 1 and e rs = 0 (norma l transm i ss i on) 1 . 0 etu after transm i ss i on of a 1 - byte ser i a l character when g m = 1 and b lk = 0 when t dr e = 1 and e rs = 0 (norma l transm i ss i on) 1 . 0 etu after transm i ss i on of a 1 - byte ser i a l character when g m = 1 and b lk = 1 [ c l ear i n g cond i t i on ] when 0 i s wr i tten to p e r after read i n g p e r = 1 * 1 [ sett i n g cond i t i on ] when, i n recept i on, the number of 1 b i ts i n the rece i ve data p l us the par i ty b i t does not match the par i ty sett i n g (even or odd) spec i f i ed by the o / e b i t i n smr * 2 data has been rece i ved norma ll y, and there i s no error s ig na l [ c l ear i n g cond i t i ons ] on reset, or i n standby mode or modu l e stop mode when 0 i s wr i tten to e rs after read i n g e rs = 1 e rror s ig na l i nd i cat i n g detect i on of par i ty error has been sent by rece i v i n g dev i ce [ sett i n g cond i t i on ] when the error s ig na l i s samp l ed at the l ow l eve l [ c l ear i n g cond i t i on ] when 0 i s wr i tten to or e r after read i n g or e r = 1 * 1 [ sett i n g cond i t i on ] when the next ser i a l recept i on i s comp l eted wh il e rdr f = 1 * 2 [ c l ear i n g cond i t i ons ] when 0 i s wr i tten to rdr f after read i n g rdr f = 1 when the d t c i s act i vated by an rx i i nterrupt and reads data from rdr [ sett i n g cond i t i on ] when ser i a l recept i on ends norma ll y and rece i ve data i s transferred from rsr to rdr [ c l ear i n g cond i t i ons ] when 0 i s wr i tten to t dr e after read i n g t dr e = 1 when the d t c i s act i vated by a t x i i nterrupt and wr i tes data to t dr [ sett i n g cond i t i ons ] when the te b i t i n scr i s 0 when data i s transferred from t dr to t sr and data can be wr i tten to t dr 1 1 1 1 1 1 1 n ote : * reta i ns i ts prev i ous state when the r e b i t i n scr i s c l eared to 0 w i th a mu l t i processor format . n ote : * c l ear i n g the te b i t i n scr to 0 does not affect the e rs f l a g , wh i ch reta i ns i ts pr i or state . n ote : * rdr and the rdr f f l a g are not affected and reta i n the i r prev i ous va l ues when an error i s detected dur i n g recept i on or when the r e b i t i n scr i s c l eared to 0 . i f recept i on of the next data i s comp l eted wh il e the rdr f f l a g i s st ill set to 1, an overrun error w ill occur and the rece i ve data w ill be l ost . n otes : 1 . t he p e r f l a g i s not affected and reta i ns i ts prev i ous state when the r e b i t i n scr i s c l eared to 0 . 2 . i f a par i ty error occurs, the rece i ve data i s transferred to rdr but the rdr f f l a g i s not set . ser i a l recept i on cannot be cont i nued wh il e the p e r f l a g i s set to 1 . i n synchronous mode, ser i a l transm i ss i on i s a l so d i sab l ed . n otes : 1 . t he or e r f l a g i s not affected and reta i ns i ts prev i ous state when the r e b i t i n scr i s c l eared to 0 . 2 . t he rece i ve data pr i or to the overrun error i s reta i ned i n rdr, and data rece i ved subsequent l y i s l ost . ser i a l recept i on cannot be cont i nued wh il e the or e r f l a g i s set to 1 . i n synchronous mode, ser i a l transm i ss i on i s a l so d i sab l ed . n ote : etu ( el ementary ti me un i t) : ti me for transfer of 1 b i t n ote : * can on l y be wr i tten w i th 0 for f l a g c l ear i n g.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1020 of 1108 rej09b0089-0700 rdr0?receive data register 0 h'ff7d sci0, smart card interface 0 7 0 r 6 0 r 5 0 r 4 0 r 3 0 r 0 0 r 2 0 r 1 0 r bit initial value read/write : : : stores received serial data scmr0?smart card mode register 0 h' ff7e sci0, smart card interface 0 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 sdir 0 r/w 0 smif 0 r/w 2 sinv 0 r/w 1 ? 1 ? 0 1 tdr contents are transmitted lsb-first receive data is stored in rdr lsb-first smart card data direction 0 1 tdr contents are transmitted as they are receive data is stored in rdr as it is smart card data invert 0 1 smart card interface function is disabled smart card interface mode select bit initial value read/write : : : smart card interface function is enabled tdr contents are inverted before bein g transmitted receive data is stored in rdr in inverted form tdr contents are transmitted msb-first receive data is stored in rdr msb-first
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1021 of 1108 rej09b0089-0700 smr1?serial mode register 1 h'ff80 sci1 7 c/ a 0 r/w 6 chr 0 r/w 5 pe 0 r/w 4 o/ e 0 r/w 3 stop 0 r/w 0 cks0 0 r/w 2 mp 0 r/w 1 cks1 0 r/w 0 1 asynchronous mode synchronous mode asynchronous mode/synchronous mode select 0 1 parity bit addition and checkin g disabled parity bit addition and checkin g enabled * parity enable 0 1 even parity * 1 odd parity * 2 parity mode 0 1 1 stop bit 2 stop bits stop bit len g th 0 1 multiprocessor function disabled multiprocessor format selected multiprocessor mode 0 1 0 1 0 1 clock /4 clock /16 clock /64 clock clock select bit initial value read/write : : : 0 1 8-bit data 7-bit data * character len g th note: * when 7-bit data is selected, the msb (bit 7) of tdr is not transmitted. with 7-bit data, it is not possible to select lsb-first or msb-first transfer. 1. when even parity is selected, the parity bit added to transmit data makes an even number of 1s in the transmitted character and parity bit combined. receive data must have an even number of 1s in the received character and parity bit combined. 2. when odd parity is selected, the parity bit added to transmit data makes an odd number of 1s in the transmitted character and parity bit combined. receive data must have an odd number of 1s in the received character and parity bit combined. notes: * when the pe bit is set to 1, the parity (even or odd) specified by the o/ e bit is added to transmit data before transmission. in reception, the parity bit is checked for the parity (even or odd) specified by the o/ e bit. note:
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1022 of 1108 rej09b0089-0700 smr1?serial mode register 1 h'ff80 smart card interface 1 7 g m 0 r / w 6 b lk 0 r / w 5 p e 0 r / w 4 o / e 0 r / w 3 bcp1 0 r / w 0 c k s0 0 r / w 2 bcp0 0 r / w 1 c k s1 0 r / w 0 1 n orma l smart card i nterface mode operat i on ten d f l a g g enerated 12 . 5 etu (11 . 5 etu i n b l ock transfer mode) after be gi nn i n g of start b i t c l ock output on / off contro l on l y g sm mode smart card i nterface mode operat i on ten d f l a g g enerated 11 . 0 etu after be gi nn i n g of start b i t fi xed h ig h /l ow -l eve l contro l poss i b l e (set i n scr) i n add i t i on to c l ock output on / off contro l g sm mode 0 1 sett i n g proh i b i ted par i ty b i t add i t i on and check i n g enab l ed * par i ty e nab l e 0 1 e ven par i ty * 1 odd par i ty * 2 par i ty mode (set to 1 when us i n g the smart card i nterface) 0 1 0 1 0 1 c l ock /4 c l ock / 16 c l ock / 6 4 c l ock c l ock se l ect b i t i n i t i a l va l ue read / wr i te : : : n ote : etu ( el ementary ti me un i t) : ti me for transfer of 1 b i t 0 1 0 1 0 1 32 c l ocks 6 4 c l ocks 372 c l ocks 256 c l ocks base c l ock pu l se bcp1 bcp0 base c l ock pu l se 0 1 n orma l smart card i nterface mode b l ock transfer mode b l ock t ransfer mode se l ect 1 . when even par i ty i s se l ected, the par i ty b i t added to transm i t data makes an even number of 1s i n the transm i tted character and par i ty b i t comb i ned . rece i ve data must have an even number of 1s i n the rece i ved character and par i ty b i t comb i ned . 2 . when odd par i ty i s se l ected, the par i ty b i t added to transm i t data makes an odd number of 1s i n the transm i tted character and par i ty b i t comb i ned . rece i ve data must have an odd number of 1s i n the rece i ved character and par i ty b i t comb i ned . n otes : * when the p e b i t i s set to 1, the par i ty (even or odd) spec i f i ed by the o / e b i t i s added to transm i t data before transm i ss i on . i n recept i on, the par i ty b i t i s checked for the par i ty (even or odd) spec i f i ed by the o / e b i t . n ote :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1023 of 1108 rej09b0089-0700 brr1?bit rate register 1 h'ff81 sci1, smart card interface 1 7 1 r/w 6 1 r/w 5 1 r/w 4 1 r/w 3 1 r/w 0 1 r/w 2 1 r/w 1 1 r/w note: for details, see section 12.2.8, bit rate re g ister (brr). sets the serial transfer bit rate bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1024 of 1108 rej09b0089-0700 scr1?serial control register 1 h'ff82 sci1 7 tie 0 r/w 6 rie 0 r/w 5 te 0 r/w 4 re 0 r/w 3 mpie 0 r/w 0 cke0 0 r/w 2 teie 0 r/w 1 cke1 0 r/w 1 0 asynchronous mode internal clock/sck pin functions as i/o port clock enable 0 1 transmit-end interrupt (tei) request disabled * transmit-end interrupt (tei) request enabled * transmit end interrupt enable 0 multiprocessor interrupts disabled [clearin g conditions] when the mpie bit is cleared to 0 when data with mpb = 1 is received multiprocessor interrupt enable 0 1 reception disabled * 1 reception enabled * 2 receive enable 0 1 transmission disabled * 1 transmission enabled * 2 transmit enable 0 receive-data-full interrupt (rxi) request and receive-error interrupt (eri) request disabled * receive interrupt enable 0 1 transmit-data-empty interrupt (txi) request disabled * transmit-data-empty interrupt (txi) request enabled transmit interrupt enable bit initial value read/write : : : synchronous mode internal clock/sck pin functions as serial clock output asynchronous mode internal clock/sck pin functions as clock output * 1 synchronous mode internal clock/sck pin functions as serial clock output asynchronous mode external clock/sck pin functions as clock input * 2 synchronous mode external clock/sck pin functions as serial clock input asynchronous mode external clock/sck pin functions as clock input * 2 synchronous mode external clock/sck pin functions as serial clock input multiprocessor interrupts enabled * receive-data-full interrupt (rxi) requests, receive-error interrupt (eri) requests, and settin g of the rdrf, fer, and orer fla g s in ssr are disabled until data with the multiprocessor bit set to 1 is received 1 1 receive-data-full interrupt (rxi) request and receive-error interrupt (eri) request enabled 1 0 1 0 notes: 1. outputs a clock of the same frequency as the bit rate. 2. inputs a clock with a frequency 16 times the bit rate notes: 1. clearin g the re bit to 0 does not affect the rdrf, fer, per, and orer fla g s, which retain their states. 2. serial reception is started in this state when a start bit is detected in asynchronous mode or serial clock input is detected in synchronous mode. smr settin g must be performed to decide the receive format before settin g the re bit to 1. notes: 1. the tdre fla g in ssr is fixed at 1. 2. in this state, serial transmission is started when transmit data is written to tdr and the tdre fla g in ssr is cleared to 0. smr settin g must be performed to decide the transmit format before settin g the te bit to 1. note: * tei clearin g can be performed by readin g 1 from the tdre fla g in ssr, then clearin g it to 0 and clearin g the tend fla g to 0, or by clearin g the teie bit to 0. note: * when receive data includin g mpb = 0 is received, receive data transfer from rsr to rdr, receive error detection, and settin g of the rdrf, fer, and orer fla g s in ssr, is not performed. when receive data includin g mpb = 1 is received, the mpb bit in ssr is set to 1, the mpie bit is cleared to 0 automatically, and g eneration of rxi and eri interrupts (when the tie and rie bits in scr are set to 1) and fer and orer fla g settin g is enabled. note: * rxi and eri interrupt requests can be cleared by readin g 1 from the rdrf, fer, per, or orer fla g , then clearin g the fla g to 0, or by clearin g the rie bit to 0. note: * txi interrupt requests can be cleared by readin g 1 from the tdre fla g , then clearin g it to 0, or by clearin g the tie bit to 0.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1025 of 1108 rej09b0089-0700 scr1?serial control register 1 h'ff82 smart card interface 1 7 tie 0 r/w 6 rie 0 r/w 5 te 0 r/w 4 re 0 r/w 3 mpie 0 r/w 0 cke0 0 r/w 2 teie 0 r/w 1 cke1 0 r/w smcr smif 0 1 1 1 1 1 1 0 0 1 1 1 1 0 0 0 0 1 1 0 1 0 1 0 1 smr g m cke1 cke0 see sci specification sck pin function clock enable scr settin g 0 1 transmit-end interrupt (tei) request disabled * transmit-end interrupt (tei) request enabled * transmit end interrupt enable 0 multiprocessor interrupts disabled [clearin g conditions] when the mpie bit is cleared to 0 when data with mpb = 1 is received multiprocessor interrupt enable 0 1 reception disabled * 1 reception enabled * 2 receive enable 0 1 transmission disabled * 1 transmission enabled * 2 transmit enable 0 receive-data-full interrupt (rxi) request and receive-error interrupt (eri) request disabled receive interrupt enable 0 1 transmit-data-empty interrupt (txi) request disabled * transmit-data-empty interrupt (txi) request enabled transmit interrupt enable bit initial value read/write : : : multiprocessor interrupts enabled * receive-data-full interrupt (rxi) requests, receive-error interrupt (eri) requests, and settin g of the rdrf, fer, and orer fla g s in ssr are disabled until data with the multiprocessor bit set to 1 is received 1 1 receive-data-full interrupt (rxi) request and receive-error interrupt (eri) request enabled operates as port i/o pin clock output as sck output pin fixed-low output as sck output pin clock output as sck output pin fixed-hi g h output as sck output pin clock output as sck output pin note: * tei clearin g can be performed by readin g 1 from the tdre fla g in ssr, then clearin g it to 0 and clearin g the tend fla g to 0, or by clearin g the teie bit to 0. note: * when receive data includin g mpb = 0 is received, receive data transfer from rsr to rdr, receive error detection, and settin g of the rdrf, fer, and orer fla g s in ssr, is not performed. when receive data includin g mpb = 1 is received, the mpb bit in ssr is set to 1, the mpie bit is cleared to 0 automatically, and g eneration of rxi and eri interrupts (when the tie and rie bits in scr are set to 1) and fer and orer fla g settin g is enabled. notes: 1. clearin g the re bit to 0 does not affect the rdrf, fer, per, and orer fla g s, which retain their states. 2. serial reception is started in this state when a start bit is detected in asynchronous mode or serial clock input is detected in synchronous mode. smr settin g must be performed to decide the receive format before settin g the re bit to 1. notes: 1. the tdre fla g in ssr is fixed at 1. 2. in this state, serial transmission is started when transmit data is written to tdr and the tdre fla g in ssr is cleared to 0. smr settin g must be performed to decide the transmit format before settin g the te bit to 1. note: * rxi and eri interrupt requests can be cleared by readin g 1 from the rdrf, fer, per, or orer fla g , then clearin g the fla g to 0, or by clearin g the rie bit to 0. note: * txi interrupt requests can be cleared by readin g 1 from the tdre fla g , then clearin g it to 0, or by clearin g the tie bit to 0.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1026 of 1108 rej09b0089-0700 tdr1?transmit data register 1 h'ff8 3 sci1, smart card interface 1 7 1 r/w 6 1 r/w 5 1 r/w 4 1 r/w 3 1 r/w 0 1 r/w 2 1 r/w 1 1 r/w stores data for serial transmission bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1027 of 1108 rej09b0089-0700 ssr1?serial status register 1 h'ff84 sci1 [settin g condition] when serial reception ends normally and receive data is transferred from rsr to rdr 7 tdre 1 r/(w) * 6 rdrf 0 r/(w) * 5 orer 0 r/(w) * 4 fer 0 r/(w) * 3 per 0 r/(w) * 0 mpbt 0 r/w 2 tend 1 r 1 mpb 0 r 0 transmit data re g ister empty 0 receive data re g ister full * 0 overrun error 0 framin g error 0 parity error 0 transmit end [clearin g conditions] ? when 0 is written to tdre after readin g tdre = 1 ? when the dtc is activated by a txi interrupt and writes data to tdr 0 multiprocessor bit [clearin g condition] when data with a 0 multiprocessor bit is received * [settin g condition] when data with a 1 multiprocessor bit is received multiprocessor bit transfer 0 1 data with a 0 multiprocessor bit is transmitted data with a 1 multiprocessor bit is transmitted bit initial value read/write : : : [settin g conditions] ? when the te bit in scr is 0 ? when tdre = 1 at transmission of the last bit of a 1-byte serial transmit character [clearin g condition] when 0 is written to per after readin g per = 1 * 1 [settin g condition] when, in reception, the number of 1 bits in the receive data plus the parity bit does not match the parity settin g (even or odd) specified by the o/ e bit in smr * 2 [clearin g condition] when 0 is written to fer after readin g fer = 1 * 1 [settin g condition] when the sci checks the stop bit at the end of the receive data when reception ends, and the stop bit is 0 * 2 [clearin g condition] when 0 is written to orer after readin g orer = 1 * 1 [settin g condition] when the next serial reception is completed while rdrf = 1 * 2 [clearin g conditions] ? when 0 is written to rdrf after readin g rdrf = 1 ? when the dtc is activated by an rxi interrupt and reads data from rdr [clearin g conditions] ? when 0 is written to tdre after readin g tdre = 1 ? when the dtc is activated by a txi interrupt and writes data to tdr [settin g conditions] ? when the te bit in scr is 0 ? when data is transferred from tdr to tsr and data can be written to tdr 1 1 1 1 1 1 1 note: * retains its previous state when the re bit in scr is cleared to 0 with a multiprocessor format. note: * rdr and the rdrf fla g are not affected and retain their previous values when an error is detected durin g reception or when the re bit in scr is cleared to 0. if reception of the next data is completed while the rdrf fla g is still set to 1, an overrun error will occur and the receive data will be lost. notes: 1. the per fla g is not affected and retains its previous state when the re bit in scr is cleared to 0. 2. if a parity error occurs, the receive data is transferred to rdr but the rdrf fla g is not set. serial reception cannot be continued while the per fla g is set to 1. in synchronous mode, serial transmission is also disabled. notes: 1. the fer fla g is not affected and retains its previous state when the re bit in scr is cleared to 0. 2. in 2-stop-bit mode, only the first stop bit is checked for a value of 1; the second stop bit is not checked. if a framin g error occurs, the receive data is transferred to rdr but the rdrf fla g is not set. serial reception cannot be continued while the fer fla g is set to 1. in synchronous mode, serial transmission is also disabled. notes: 1. the orer fla g is not affected and retains its previous state when the re bit in scr is cleared to 0. 2. the receive data prior to the overrun error is retained in rdr, and data received subsequently is lost. serial reception cannot be continued while the orer fla g is set to 1. in synchronous mode, serial transmission is also disabled. note: * can only be written with 0 for fla g clearin g .
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1028 of 1108 rej09b0089-0700 ssr1?serial status register 1 h' ff84 smart card interface 1 7 t dr e 1 r / (w) * 6 rdr f 0 r / (w) * 5 or e r 0 r / (w) * 4 e rs 0 r / (w) * 3 p e r 0 r / (w) * 0 mpb t 0 r / w 2 ten d 1 r 1 mpb 0 r 0 t ransm i t data re gi ster e mpty 0 rece i ve data re gi ster f u ll * 0 overrun e rror 0 e rror s ig na l status * 0 par i ty e rror 0 t ransm i t e nd t ransm i ss i on i n pro g ress [ c l ear i n g cond i t i ons ] ? when 0 i s wr i tten to t dr e after read i n g t dr e = 1 ? when the d t c i s act i vated by a t x i i nterrupt and wr i tes data to t dr 0 mu l t i processor b i t [ c l ear i n g cond i t i on ] when data w i th a 0 mu l t i processor b i t i s rece i ved * [ sett i n g cond i t i on ] when data w i th a 1 mu l t i processor b i t i s rece i ved mu l t i processor b i t t ransfer 0 1 data w i th a 0 mu l t i processor b i t i s transm i tted data w i th a 1 mu l t i processor b i t i s transm i tted b i t i n i t i a l va l ue read / wr i te : : : t ransm i ss i on has ended [ sett i n g cond i t i ons ] ? on reset, or i n standby mode or modu l e stop mode ? when the te b i t i n scr i s 0 and the e rs b i t i s 0 ? when t dr e = 1 and e rs = 0 (norma l transm i ss i on) 2 . 5 etu after transm i ss i on of a 1 - byte ser i a l character when g m = 0 and b lk = 0 ? when t dr e = 1 and e rs = 0 (norma l transm i ss i on) 1 . 5 etu after transm i ss i on of a 1 - byte ser i a l character when g m = 0 and b lk = 1 ? when t dr e = 1 and e rs = 0 (norma l transm i ss i on) 1 . 0 etu after transm i ss i on of a 1 - byte ser i a l character when g m = 1 and b lk = 0 ? when t dr e = 1 and e rs = 0 (norma l transm i ss i on) 1 . 0 etu after transm i ss i on of a 1 - byte ser i a l character when g m = 1 and b lk = 1 [ c l ear i n g cond i t i on ] when 0 i s wr i tten to p e r after read i n g p e r = 1 * 1 [ sett i n g cond i t i on ] when, i n recept i on, the number of 1 b i ts i n the rece i ve data p l us the par i ty b i t does not match the par i ty sett i n g (even or odd) spec i f i ed by the o /e b i t i n smr * 2 data has been rece i ved norma ll y, and there i s no error s ig na l [ c l ear i n g cond i t i ons ] ? on reset, or i n standby mode or modu l e stop mode ? when 0 i s wr i tten to e rs after read i n g e rs = 1 e rror s ig na l i nd i cat i n g detect i on of par i ty error has been sent by rece i v i n g dev i ce [ sett i n g cond i t i on ] when the error s ig na l i s samp l ed at the l ow l eve l [ c l ear i n g cond i t i on ] when 0 i s wr i tten to or e r after read i n g or e r = 1 * 1 [ sett i n g cond i t i on ] when the next ser i a l recept i on i s comp l eted wh il e rdr f = 1 * 2 [ c l ear i n g cond i t i ons ] ? when 0 i s wr i tten to rdr f after read i n g rdr f = 1 ? when the d t c i s act i vated by an rx i i nterrupt and reads data from rdr [ sett i n g cond i t i on ] when ser i a l recept i on ends norma ll y and rece i ve data i s transferred from rsr to rdr [ c l ear i n g cond i t i ons ] ? when 0 i s wr i tten to t dr e after read i n g t dr e = 1 ? when the d t c i s act i vated by a t x i i nterrupt and wr i tes data to t dr [ sett i n g cond i t i ons ] ? when the te b i t i n scr i s 0 ? when data i s transferred from t dr to t sr and data can be wr i tten to t dr 1 1 1 1 1 1 1 n ote : * reta i ns i ts prev i ous state when the r e b i t i n scr i s c l eared to 0 w i th a mu l t i processor format . n ote : * c l ear i n g the te b i t i n scr to 0 does not affect the e rs f l a g , wh i ch reta i ns i ts pr i or state . n ote : * rdr and the rdr f f l a g are not affected and reta i n the i r prev i ous va l ues when an error i s detected dur i n g recept i on or when the r e b i t i n scr i s c l eared to 0 . i f recept i on of the next data i s comp l eted wh il e the rdr f f l a g i s st ill set to 1, an overrun error w ill occur and the rece i ve data w ill be l ost . n otes : 1 . t he p e r f l a g i s not affected and reta i ns i ts prev i ous state when the r e b i t i n scr i s c l eared to 0 . 2 . i f a par i ty error occurs, the rece i ve data i s transferred to rdr but the rdr f f l a g i s not set . ser i a l recept i on cannot be cont i nued wh il e the p e r f l a g i s set to 1 . i n synchronous mode, ser i a l transm i ss i on i s a l so d i sab l ed . n otes : 1 . t he or e r f l a g i s not affected and reta i ns i ts prev i ous state when the r e b i t i n scr i s c l eared to 0 . 2 . t he rece i ve data pr i or to the overrun error i s reta i ned i n rdr, and data rece i ved subsequent l y i s l ost . ser i a l recept i on cannot be cont i nued wh il e the or e r f l a g i s set to 1 . i n synchronous mode, ser i a l transm i ss i on i s a l so d i sab l ed . n ote : etu ( el ementary ti me un i t) : ti me for transfer of 1 b i t n ote : * can on l y be wr i tten w i th 0 for f l a g c l ear i n g.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1029 of 1108 rej09b0089-0700 rdr1?receive data register 1 h'ff85 sci1, smart card interface 1 7 0 r 6 0 r 5 0 r 4 0 r 3 0 r 0 0 r 2 0 r 1 0 r stores received serial data bit initial value read/write : : : scmr1?smart card mode register 1 h' ff86 sci1, smart card interface 1 7 ? 1 ? 6 ? 1 ? 5 ? 1 ? 4 ? 1 ? 3 sdir 0 r/w 0 smif 0 r/w 2 sinv 0 r/w 1 ? 1 ? 0 1 tdr contents are transmitted lsb-first receive data is stored in rdr lsb-first smart card data direction 0 tdr contents are transmitted as they are receive data is stored in rdr as it is smart card data invert 0 1 smart card interface function is disabled smart card interface mode select bit initial value read/write : : : smart card interface function is enabled tdr contents are inverted before bein g transmitted receive data is stored in rdr in inverted form 1 tdr contents are transmitted msb-first receive data is stored in rdr msb-first
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1030 of 1108 rej09b0089-0700 addrah?a/d data register ah h'ff90 a/d converter addral?a/d data register al h'ff91 a/d converter addrbh?a/d data register bh h'ff92 a/d converter addrbl?a/d data register bl h'ff93 a/d converter addrch?a/d data register ch h'ff94 a/d converter addrcl?a/d data register cl h'ff95 a/d converter addrdh?a/d data register dh h'ff96 a/d converter addrdl?a/d data register dl h'ff97 a/d converter 15 ad9 0 r 14 ad8 0 r 13 ad7 0 r 12 ad6 0 r 11 ad5 0 r 10 ad4 0 r 9 ad3 0 r 8 ad2 0 r 7 ad1 0 r 6 ad0 0 r 5 ? 0 r 4 ? 0 r 3 ? 0 r 2 ? 0 r 1 ? 0 r 0 ? 0 r stores the results of a/d conversion analo g input channel a/d data re g ister bit initial value read/write : : : addra addrb addrc addrd g roup 0 an0 an1 an2 an3 g roup 1 an4 an5 an6 an7
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1031 of 1108 rej09b0089-0700 adcsr?a/d control/status register h'ff98 a/d converter [clearin g conditions] ? when 0 is written to the adf fla g after readin g adf = 1 ? when the dtc is activated by an adi interrupt, and addr is read 7 adf 0 r/(w) * 6 adie 0 r/w 5 adst 0 r/w 4 scan 0 r/w 3 cks 0 r/w 0 ch0 0 r/w 2 ch2 0 r/w 1 ch1 0 r/w note: * can only be written with 0 for fla g clearin g . 0 1 a/d conversion end interrupt request disabled a/d conversion end interrupt request enabled a/d interrupt enable 0 1 sin g le mode scan mode scan mode g roup selection ch2 ch1 ch0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 an0 an1 an2 an3 an4 an5 an6 an7 an0 an0, an1 an0 to an2 an0 to an3 an4 an4, an5 an4 to an6 an4 to an7 channel selection description 0 1 a/d conversion stopped a/d start 0 a/d end fla g bit initial value read/write : : : ? sin g le mode: a/d conversion is started. cleared to 0 automatically when conversion ends ? scan mode: a/d conversion is started. conversion continues sequentially on the selected channels until adst is cleared to 0 by software, a reset, or transition to standby mode or module stop mode [settin g conditions] ? sin g le mode: when a/d conversion ends ? scan mode: when a/d conversion ends on all specified channels 1 0 1 0 1 0 1 description clock select cks is used in combination with cks1, bit 3 in adcr. conversion time = 530 states (max.) conversion time = 68 states (max.) conversion time = 266 states (max.) conversion time = 134 states (max.) cks cks1 bit 3 adcr bit 3 sin g le mode (scan = 0) scan mode (scan = 1) channel select note: these bits select the analo g input channel(s). ensure that conversion is halted (adst = 0) before makin g a channel settin g .
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1032 of 1108 rej09b0089-0700 adcr?a/d control register h'ff99 a/d converter 7 tr g s1 0 r/w 6 tr g s0 0 r/w 5 ? 1 ? 4 ? 1 ? 3 cks1 1 r/w 0 ? 1 ? 2 ? 1 r/w 1 ? 1 ? 0 1 0 1 0 1 description timer tri gg er select bit initial value read/write : : : a/d conversion start by external tri gg er is disabled a/d conversion start by external tri gg er (tpu) is enabled a/d conversion start by external tri gg er (8-bit timer) is enabled a/d conversion start by external tri gg er pin ( adtrg ) is enabled tr g s1 tr g s1 0 1 0 1 0 1 description clock select cks1 is used in combination with cks, bit 3 in adcsr. reserved only 1 should be written to this bit. conversion time = 530 states (max.) conversion time = 68 states (max.) conversion time = 266 states (max.) conversion time = 134 states (max.) cks cks1 adcsr bit 3 bit 3 dadr0?d/a data register 0 h'ffa4 d/a converter dadr1?d/a data register 1 h'ffa5 d/a converter 7 0 r/w 6 0 r/w 5 0 r/w 4 0 r/w 3 0 r/w 0 0 r/w 2 0 r/w 1 0 r/w stores data for d/a conversion bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1033 of 1108 rej09b0089-0700 dacr01?d/a control register 01 h'ffa6 d/a converter 7 daoe1 0 r/w 6 daoe0 0 r/w 5 dae 0 r/w 4 ? 1 ? 3 ? 1 ? 0 ? 1 ? 2 ? 1 ? 1 ? 1 ? d/a conversion control daoe1 daoe0 dae description 0 1 0 1 0 1 0 1 0 1 channel 0 and 1 d/a conversion disabled channel 0 d/a conversion enabled channel 1 d/a conversion disabled channel 0 and 1 d/a conversion enabled channel 0 d/a conversion disabled channel 1 d/a conversion enabled channel 0 and 1 d/a conversion enabled channel 0 and 1 d/a conversion enabled : don't care 0 1 analo g output da0 is disabled channel 0 d/a conversion is enabled d/a output enable 0 0 1 analo g output da1 is disabled channel 1 d/a conversion is enabled d/a output enable 1 bit initial value read/write : : : analo g output da0 is enabled analo g output da1 is enabled
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1034 of 1108 rej09b0089-0700 pfcr2?port function control register 2 h'ffac ports 0 1 pf6 is desi g nated as as output pin pf6 is desi g nated as i/o port, and does not function as as output pin as output disable * 0 1 cs2 , cs3 , cs4 , and cs5 output disabled (can be used as i/o ports) cs2 , cs3 , cs4 , and cs5 output enabled cs25 enable * 1 * 2 0 1 cs1 , cs6 , and cs7 output disabled (can be used as i/o ports) cs1 , cs6 , and cs7 output enabled cs167 enable * 1 * 2 reserved only 0 should be written to these bits 7 ? 0 r/w 6 ? 0 r/w 5 cs167e 1 r/w 4 cs25e 1 r/w 3 asod 0 r/w 0 ? 0 r 2 ? 0 r 1 ? 0 r bit initial value read/write : : : note: * this bit is valid in modes 4 to 6. notes: 1. this bit is valid in modes 4 to 6. 2. clear the ddr bits to 0 before chan g in g the cs25e settin g . notes: 1. this bit is valid in modes 4 to 6. 2. clear the ddr bits to 0 before chan g in g the cs167e settin g .
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1035 of 1108 rej09b0089-0700 tcr0?time control register 0 h'ffb0 8-bit timer channel 0 tcr1?time control register 1 h'ffb1 8-bit timer channel 1 7 cmieb 0 r/w 6 cmiea 0 r/w 5 ovie 0 r/w 4 cclr1 0 r/w 3 cclr0 0 r/w 0 cks0 0 r/w 2 cks2 0 r/w 1 cks1 0 r/w note: * 000 1 clock input disabled internal clock: counted at fallin g ed g e of /8 internal clock: counted at fallin g ed g e of /64 10 internal clock: counted at fallin g ed g e of /8192 1 1 0 0 for channel 0: count at tcnt1 overflow si g nal * for channel 1: count at tcnt0 compare match a * external clock: counted at risin g ed g e external clock: counted at fallin g ed g e 1 0 1 external clock: counted at both risin g and fallin g ed g es 1 clock select 0 1 cmfb interrupt requests (cmib) are disabled cmfb interrupt requests (cmib) are enabled compare match interrupt enable b 0 1 cmfa interrupt requests (cmia) are disabled cmfa interrupt requests (cmia) are enabled compare match interrupt enable a 0 1 ovf interrupt requests (ovi) are disabled ovf interrupt requests (ovi) are enabled timer overflow interrupt enable 0 1 clear is disabled clear by compare match a clear by compare match b clear by risin g ed g e of external reset input 0 1 0 1 counter clear bit initial value read/write if the count input of channel 0 is the tcnt1 overflow si g nal and that of channel 1 is the tcnt0 compare match si g nal, no incrementin g clock is g enerated. do not use this settin g . : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1036 of 1108 rej09b0089-0700 tcsr0?timer control/status register 0 h'ffb2 8-bit timer channel 0 tcsr1?timer control/status register 1 h'ffb3 8-bit timer channel 1 7 cmfb 0 r/(w) * 6 cmfa 0 r/(w) * 5 ovf 0 r/(w) * 4 ? 1 ? 3 os3 0 r/w 0 os0 0 r/w 2 os2 0 r/w 1 os1 0 r/w tcsr1 7 cmfb 0 r/(w) * 6 cmfa 0 r/(w) * 5 ovf 0 r/(w) * 4 adte 0 r/w 3 os3 0 r/w 0 os0 0 r/w 2 os2 0 r/w 1 os1 0 r/w tcsr0 note: * only 0 can be written to bits 7 to 5, to clear these fla g s. 0 1 compare match fla g b 0 1 compare match fla g a 0 [clearin g condition] when 0 is written to ovf after readin g ovf = 1 1 timer overflow fla g 0 1 a/d converter start requests by compare match a are disabled a/d converter start requests by compare match a are enabled a/d tri gg er enable (tcsr0 only) 0 1 no chan g e when compare match b occurs 0 is output when compare match b occurs 1 is output when compare match b occurs 0 1 0 1 output select bit initial value read/write : : : bit initial value read/write : : : [settin g condition] when tcnt overflows (chan g es from h'ff to h'00) [clearin g conditions] ? when 0 is written to cmfa after readin g cmfa = 1 ? when the dtc is activated by a cmia interrupt, while the disel bit of mrb in dtc is 0 [settin g condition] when tcnt matches tcora [clearin g conditions] ? when 0 is written to cmfb after readin g cmfb = 1 ? when the dtc is activated by a cmib interrupt, while the disel bit of mrb in dtc is 0 [settin g condition] when tcnt matches tcorb output is inverted when compare match b occurs (to gg le output) 0 no chan g e when compare match a occurs 0 output select output is inverted when compare match a occurs (to gg le output) 1 is output when compare match a occurs 0 is output when compare match a occurs 1 1 0 1
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1037 of 1108 rej09b0089-0700 tcora0?time constant register a0 h'ffb4 8-bit timer channel 0 tcora1?time constant register a1 h'ffb5 8-bit timer channel 1 15 1 r/w 14 1 r/w 13 1 r/w 12 1 r/w 11 1 r/w 10 1 r/w 9 1 r/w 8 1 r/w 7 1 r/w 6 1 r/w 5 1 r/w 4 1 r/w 3 1 r/w 2 1 r/w 1 1 r/w 0 1 r/w tcora0 tcora1 bit initial value read/write : : : tcorb0?time constant register b0 h'ffb6 8-bit timer channel 0 tcorb1?time constant register b1 h'ffb7 8-bit timer channel 1 15 1 r/w 14 1 r/w 13 1 r/w 12 1 r/w 11 1 r/w 10 1 r/w 9 1 r/w 8 1 r/w 7 1 r/w 6 1 r/w 5 1 r/w 4 1 r/w 3 1 r/w 2 1 r/w 1 1 r/w 0 1 r/w tcorb0 tcorb1 bit initial value read/write : : : tcnt0?timer counter 0 h'ffb8 8-bit timer channel 0 tcnt1?timer counter 1 h'ffb9 8-bit timer channel 1 15 0 r/w 14 0 r/w 13 0 r/w 12 0 r/w 11 0 r/w 10 0 r/w 9 0 r/w 8 0 r/w 7 0 r/w 6 0 r/w 5 0 r/w 4 0 r/w 3 0 r/w 2 0 r/w 1 0 r/w 0 0 r/w tcnt0 tcnt1 bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1038 of 1108 rej09b0089-0700 tcsr?timer control/status register h'ffbc (w), h'ffbc (r) wdt notes: 1. the method for writin g to tcsr is different from that for g eneral re g isters to prevent accidental overwritin g . for details, see section 11.2.4, notes on re g ister access. 2. can only be written with 0 for fla g clearin g . 0 [clearin g condition] when 0 is written to ovf after readin g ovf = 1 1 overflow fla g 0 interval timer mode: sends the cpu an interval timer interrupt request (wovi) when tcnt overflows watchdo g timer mode: g enerates the wdtovf si g nal * 1 when tcnt overflows * 2 1 timer mode select 0 1 tcnt is initialized to h'00 and halted tcnt counts timer enable clock select cks2 cks1 cks0 clock overflow period * (when = 20 mhz) 0 1 0 1 0 1 0 1 0 1 0 1 0 1 /2 /64 /128 /512 /2048 /8192 /32768 /131072 25.6 s 819.2 s 1.6 ms 6.6 ms 26.2 ms 104.9 ms 419.4 ms 1.68s note: * the overflow period is the time from when tcnt starts countin g up from h'00 until overflow occurs. [settin g condition] when tcnt overflows from h'ff to h'00 in interval timer mode 7 ovf 0 r/(w) * 2 6 wt/ it 0 r/w 5 tme 0 r/w 4 ? 1 ? 3 ? 1 ? 0 cks0 0 r/w 2 cks2 0 r/w 1 cks1 0 r/w bit initial value read/write * 1 : : : notes: 1. the wdtovf pin function cannot be used in the f-ztat versions. 2. for details of the case where tcnt overflows in watchdo g timer mode, see section 11.2.3, reset control/status re g ister (rstcsr).
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1039 of 1108 rej09b0089-0700 tcnt?timer counter h'ffbc (w), h'ffbd (r) wdt 7 0 r/w 6 0 r/w 5 0 r/w 4 0 r/w 3 0 r/w 0 0 r/w 2 0 r/w 1 0 r/w bit initial value read/write : : : note: the method for writin g to tcnt different from that for g eneral re g isters to prevent accidental overwrittin g . for details, see section 11.2.4, notes on re g ister access. rstcsr?reset control/status regi ster h'ffbe (w), h'ffbf (r) wdt 7 wovf 0 r/(w) * 6 rste 0 r/w 5 ? 0 r/w 4 ? 1 ? 3 ? 1 ? 0 ? 1 ? 2 ? 1 ? 1 ? 1 ? 0 1 [clearin g condition] cleared by readin g rstcsr when wovf = 1, then writin g 0 to wovf. watchdo g timer overflow fla g notes: the method for writin g to rstcsr is different from that for g eneral re g isters to preven t accidental overwritin g . for details, see section 11.2.4, notes on re g ister access. * can only be written with 0 for fla g clearin g . 0 1 reset enable reset si g nal is not g enerated if tcnt overflows * reset si g nal is g enerated if tcnt overflows reserved this bit should be written with 0. bit initial value read/write : : : [settin g condition] when tcnt overflows (chan g es from h'ff to h'00) durin g watchdo g timer operation note: * the modules in the chip are not reset, but tcnt and tcsr in wdt are reset.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1040 of 1108 rej09b0089-0700 tstr?timer start register h'ffc0 tpu 7 ? 0 ? 6 ? 0 ? 5 cst5 0 r/w 4 cst4 0 r/w 3 cst3 0 r/w 0 cst0 0 r/w 2 cst2 0 r/w 1 cst1 0 r/w counter start 0 1 tcntn count operation is stopped tcntn performs count operation note: (n = 5 to 0) if 0 is written to the cst bit durin g operation with the tioc pin desi g nated for output, the counter stops but the tioc pin output compare output level is retained. if tior is written to when the cst bit is cleared to 0, the pin output level will be chan g ed to the set initial output value. bit initial value read/write : : : tsyr?timer synchro register h'ffc1 tpu 7 ? 0 ? 6 ? 0 ? 5 sync5 0 r/w 4 sync4 0 r/w 3 sync3 0 r/w 0 sync0 0 r/w 2 sync2 0 r/w 1 sync1 0 r/w timer synchronization 0 1 tcntn operates independently (tcnt presettin g / clearin g is unrelated to other channels) (n = 5 to 0) notes: to set synchronous operation, the sync bits for at least two channels must be set to 1. to set synchronous clearin g , in addition to the sync bit, the tcnt clearin g source must also be set by means of bits cclr2 to cclr0 in tcr. 1. 2. bit initial value read/write : : : tcntn performs synchronous operation tcnt synchronous presettin g /synchronous clearin g is possible
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1041 of 1108 rej09b0089-0700 flmcr1?flash memory control register 1 h'ffc8 flash memory (valid in the h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat only) 7 fwe 1/0 * r 6 swe 0 r/w 5 esu 0 r/w 4 psu 0 r/w 3 ev 0 r/w 0 p 0 r/w 2 pv 0 r/w 1 e 0 r/w bit initial value read/write : : : pro g ram * 0pro g ram mode cleared 1 transition to pro g ram mode [settin g condition] when fwe = 1, swe = 1, and psu = 1 erase * 0 erase mode cleared 1 transition to erase mode [settin g condition] when fwe = 1, swe = 1, and esu = 1 pro g ram-verify * 0pro g ram-verify mode cleared 1 transition to pro g ram-verify mode [settin g condition] when fwe = 1 and swe = 1 software write enable * 0 writes disabled 1 writes enabled [settin g condition] when fwe = 1 flash write enable note: * determined by the state of the fwe pin. 0 when a low level is input to the fwe pin (hardware-protected state) 1 when a hi g h level is input to the fwe pin erase-verify * 0 erase-verify mode cleared 1 transition to erase-verify mode [settin g condition] when fwe = 1 and swe = 1 pro g ram setup * 0pro g ram setup cleared 1pro g ram setup [settin g condition] when fwe = 1 and swe = 1 erase setup * 0 erase setup cleared 1 erase setup [settin g condition] when fwe = 1 and swe = 1 note: * valid for addresses h'000000 to h'03ffff in h8s/2318 f-ztat, h'000000 to h'01ffff in h8s/2317 f-ztat, and h'000000 to h'05ffff in h8s/2315 f-ztat and h8s/2314 f-ztat. note: * valid for addresses h'000000 to h'03ffff in h8s/2318 f-ztat, h'000000 to h'01ffff in h8s/2317 f-ztat, and h'000000 to h'05ffff in h8s/2315 f-ztat and h8s/2314 f-ztat. note: * valid for addresses h'000000 to h'03ffff in h8s/2318 f-ztat, h'000000 to h'01ffff in h8s/2317 f-ztat, and h'000000 to h'05ffff in h8s/2315 f-ztat and h8s/2314 f-ztat. note: * valid for addresses h'000000 to h'03ffff in h8s/2318 f-ztat, h'000000 to h'01ffff in h8s/2317 f-ztat, and h'000000 to h'05ffff in h8s/2315 f-ztat and h8s/2314 f-ztat. note: * valid for addresses h'000000 to h'03ffff in h8s/2318 f-ztat, h'000000 to h'01ffff in h8s/2317 f-ztat, and h'000000 to h'05ffff in h8s/2315 f-ztat and h8s/2314 f-ztat. note: * valid for addresses h'000000 to h'03ffff in h8s/2318 f-ztat, h'000000 to h'01ffff in h8s/2317 f-ztat, and h'000000 to h'05ffff in h8s/2315 f-ztat and h8s/2314 f-ztat. note: * valid for addresses h'000000 to h'03ffff in h8s/2318 f-ztat, h'000000 to h'01ffff in h8s/2317 f-ztat, and h'000000 to h'05ffff in h8s/2315 f-ztat and h8s/2314 f-ztat.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1042 of 1108 rej09b0089-0700 flmcr1?flash memory control register 1 h'ffc8 flash memory (valid in the h8s/2319 f-ztat only) 7 fwe 1 r 6 swe1 0 r/w 5 esu1 0 r/w 4 psu1 0 r/w 3 ev1 0 r/w 0 p1 0 r/w 2 pv1 0 r/w 1 e1 0 r/w bit initial value read/write : : : pro g ram 1 * 0pro g ram mode cleared 1 transition to pro g ram mode [settin g condition] when swe1 = 1 and psu1 = 1 erase 1 * 0 erase mode cleared 1 transition to erase mode [settin g condition] when swe1 = 1 and esu1 = 1 pro g ram-verify 1 * 0pro g ram-verify mode cleared 1 transition to pro g ram-verify mode [settin g condition] when swe1 = 1 software write enable 1 * 0 writes disabled 1 writes enabled flash write enable always read as 1 and cannot be written to. note: * valid for addresses h'000000 to h'03ffff. note: * valid for addresses h'000000 to h'03ffff. note: * valid for addresses h'000000 to h'03ffff. note: * valid for addresses h'000000 to h'03ffff. note: * valid for addresses h'000000 to h'03ffff. note: * valid for addresses h'000000 to h'03ffff. note: * valid for addresses h'000000 to h'03ffff. erase-verify 1 * 0 erase-verify mode cleared 1 transition to erase-verify mode [settin g condition] when swe1 = 1 pro g ram setup 1 * 0pro g ram setup cleared 1pro g ram setup [settin g condition] when swe1 = 1 erase setup 1 * 0 erase setup cleared 1 erase setup [settin g condition] when swe1 = 1
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1043 of 1108 rej09b0089-0700 flmcr2?flash memory control register 2 h'ffc9 flash memory (valid in h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat only) 7 fler 0 r 6 ? 0 ? 5 ? 0 ? 4 ? 0 ? 3 ? 0 ? 0 ? 0 ? 2 ? 0 ? 1 ? 0 ? bit initial value read/write : : : flash memory error 0 flash memory is operatin g normally flash memory pro g ram/erase protection (error protection) is disabled [clearin g condition] reset or hardware standby mode 1 an error has occurred durin g flash memory pro g rammin g /erasin g flash memory pro g ram/erase protection (error protection) is enabled [settin g condition] see section 17.8.3, error protection
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1044 of 1108 rej09b0089-0700 flmcr2?flash memory control register 2 h'ffc9 flash memory (valid in the h8s/2319 f-ztat only) 7 fler 0 r 6 swe2 0 r/w 5 esu2 0 r/w 4 psu2 0 r/w 3 ev2 0 r/w 0 p2 0 r/w 2 pv2 0 r/w 1 e2 0 r/w bit initial value read/write : : : pro g ram 2 * 0pro g ram mode cleared 1 transition to pro g ram mode [settin g condition] when swe2 = 1 and psu2 = 1 erase 2 * 0 erase mode cleared 1 transition to erase mode [settin g condition] when swe2 = 1 and esu2 = 1 pro g ram-verify 2 * 0pro g ram-verify mode cleared 1 transition to pro g ram-verify mode [settin g condition] when swe2 = 1 software write enable 2 * 0 writes disabled 1 writes enabled note: * valid for addresses h'040000 to h'07ffff. erase-verify 2 * 0 erase-verify mode cleared 1 transition to erase-verify mode [settin g condition] when swe2 = 1 pro g ram setup 2 * 0pro g ram setup cleared 1pro g ram setup [settin g condition] when swe2 = 1 erase setup 2 * 0 erase setup cleared 1 erase setup [settin g condition] when swe2 = 1 flash memory error 0 flash memory is operatin g normally flash memory pro g ram/erase protection (error protection) is disabled [clearin g condition] reset or hardware standby mode 1 an error has occurred durin g flash memory pro g rammin g /erasin g flash memory pro g ram/erase protection (error protection) is enabled [settin g condition] see section 17.17.3, error protection
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1045 of 1108 rej09b0089-0700 ebr1?erase block register 1 h'ffca flash memory ebr2?erase block register 2 h'ffcb flash memory (valid only in the h8s/2319 f-ztat, h8s/2318 f-ztat, h8s/2317 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat) 7 eb7 0 r/w 6 eb6 0 r/w 5 eb5 0 r/w 4 eb4 0 r/w 3 eb3 0 r/w 0 eb0 0 r/w 2 eb2 0 r/w 1 eb1 0 r/w bit ebr1 initial value read/write : : : 7 eb15 * 3 0 r/w * 3 6 eb14 * 3 0 r/w * 3 5 eb13 * 2 0 r/w * 2 4 eb12 * 2 0 r/w * 2 3 eb11 * 1 0 r/w * 1 0 eb8 0 r/w 2 eb10 * 1 0 r/w * 1 1 eb9 0 r/w bit ebr2 initial value read/write notes: 1. valid in the h8s/2319 f-ztat, h8s/2318 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat. in other products, write 0 to these bits. 2. valid in the h8s/2319 f-ztat, h8s/2315 f-ztat, and h8s/2314 f-ztat. in other products, write 0 to these bits. 3. valid in the h8s/2319 f-ztat. in other products, write 0 to these bits. : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1046 of 1108 rej09b0089-0700 fccs?flash code control status register h'ffc4 flash (valid only in the h8s/2319c f-ztat) 7 ? 1 r 6 ? 0 r 5 ? 0 r 4 fle r 0 r 3 ? 0 r 0 sco 0 (r) / w 2 ? 0 r 1 ? 0 r b i t i n i t i a l va l ue read / wr i te : : : fl ash memory e rror 0 1 fl ash memory operates norma ll y pro g ramm i n g/ eras i n g protect i on for f l ash memory (error protect i on) i s i nva li d . [ c l ear i n g cond i t i on ] at a power - on reset or i n hardware standby mode i nd i cates an error occurs dur i n g pro g ramm i n g/ eras i n g f l ash memory . pro g ramm i n g/ eras i n g protect i on for f l ash memory (error protect i on) i s va li d . [ sett i n g cond i t i on ] see sect i on 17 . 25 . 3, e rror protect i on source pro g ram copy operat i on 0 1 down l oad of the on - ch i p pro g ramm i n g/ eras i n g pro g ram to the on - ch i p ram i s not executed [ c l ear i n g cond i t i on ] when down l oad i s comp l eted request that the on - ch i p pro g ramm i n g/ eras i n g pro g ram i s down l oaded to the on - ch i p ram i s occurred [ sett i n g cond i t i ons ] when a ll of the fo ll ow i n g cond i t i ons are sat i sf i ed and 1 i s wr i tten to th i s b i t ? fkey i s wr i tten to h' a5 ? dur i n g execut i on i n the on - ch i p ram ? n ot i n ram emu l at i on mode (rams i n ram e r = 0) reserved b i t t h i s b i t i s a l ways read as 1 . t he wr i te va l ue shou l d a l ways be 1 . reserved b i ts t hese b i ts are a l ways read as 0 . t he wr i te va l ue shou l d a l ways be 0 . reserved b i ts t hese b i ts are a l ways read as 0 . t he wr i te va l ue shou l d a l ways be 0 .
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1047 of 1108 rej09b0089-0700 fpcs?flash program code se lect register h'ffc5 flash (valid only in the h8s/2319c f-ztat) 7 fvch g e 0 r/w 6 ? 0 r/w 5 ? 0 r/w 4 ? 0 r/w 3 ? 0 r/w 0 ? 0 r/w 2 ? 0 r/w 1 ? 0 r/w bit initial value read/write : : : vector switch function valid 1 function for modifyin g the space which reads the vector table data is valid function for modifyin g the space which reads the vector table data is invalid 0 reserved bits these bits are always read as 0. the write value should always be 0. fecs?flash erase code se lect register h'ffc6 flash (valid only in the h8s/2319c f-ztat) 7 ? 0 r 6 ? 0 r 5 ? 0 r 4 ? 0 r 3 ? 0 r 0 epvb 0 r/w 2 ? 0 r 1 ? 0 r bit initial value read/write : : : erase pulse verify block 0 1 on-chip erasin g pro g ram is not selected [clear condition] when transfer is completed on-chip erasin g pro g ram is selected reserved bits these bits are always read as 0. the write value should always be 0.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1048 of 1108 rej09b0089-0700 fkey?flash key code register h'ffc8 flash (valid only in the h8s/2319c f-ztat) 7 k7 0 r/w 6 k6 0 r/w 5 k5 0 r/w 4 k4 0 r/w 3 k3 0 r/w 0 k0 0 r/w 2 k2 0 r/w 1 k1 0 r/w bit initial value read/write : : : key code h'a5 h'5a h'00 writin g to the sco bit is enabled (the sco bit cannot be set by the value other than h'a5.) pro g rammin g /erasin g is enabled (the value other than h'5a is in software protection state.) initial value fmats?flash mat select register h'ffc9 flash (valid only in the h8s/2319c f-ztat) 7 ms7 0 1 r/w 6 ms6 0 0 r/w 5 ms5 0 1 r/w 4 ms4 0 0 r/w 3 ms3 0 1 r/w 0 ms0 0 0 r/w 2 ms2 0 0 r/w 1 ms1 0 1 r/w bit initial value initial value read/write : : : : mat select h'aa h'00 the user boot mat is selected (in user-mat selection state when the value of these bits are other than h'aa) initial value when these bits are initiated in user boot mode initial value when these bits are initiated in a mode except for user boot mode (in user-mat selection state) (when not in user boot mode) (when in user boot mode) [pro g rammable condition] these bits are in the execution state in the on-chip ram.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1049 of 1108 rej09b0089-0700 ftdar?flash transfer destination address register h'ffca flash (valid only in the h8s/2319c f-ztat) 7 tder 0 r/w 6 tda6 0 r/w 5 tda5 0 r/w 4 tda4 0 r/w 3 tda3 0 r/w 0 tda0 0 r/w 2 tda2 0 r/w 1 tda1 0 r/w bit initial value read/write : : : transfer destination address h'00 h'01 h'02 download start address is set to h'ffbc00 download start address is set to h'ffcc00 download start address is set to h'ffdc00 h'03 download start address is set to h'ffec00 h'04 to h'7f settin g prohibited. if this value is set, the tder bit (bit 7) is set to 1 to abort the download processin g tda6 to tda0 description transfer destination address settin g error 1 settin g of tder and tda4 to tda0 is h'04 to h'ff and download has been aborted settin g of tda6 to tda0 is normal 0
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1050 of 1108 rej09b0089-0700 tcr0?timer control register 0 h'ffd0 tpu0 (valid only in the h8s/2319c f-ztat) 7 cclr2 0 r/w 6 cclr1 0 r/w 5 cclr0 0 r/w 4 cke g 1 0 r/w 3 cke g 0 0 r/w 0 tpsc0 0 r/w 2 tpsc2 0 r/w 1 tpsc1 0 r/w tcnt clearin g disabled tcnt cleared by t g ra compare match/input capture tcnt cleared by t g rb compare match/input capture tcnt cleared by counter clearin g for another channel counter clear 0 0 1 0 1 0 1 0 1 clock ed g e 0 1 ? count at risin g ed g e count at fallin g ed g e count at both ed g es internal clock: counts on /1 internal clock: counts on /4 internal clock: counts on /16 internal clock: counts on /64 external clock: counts on tclka pin input external clock: counts on tclkb pin input external clock: counts on tclkc pin input external clock: counts on tclkd pin input time prescaler 0 1 0 1 0 1 0 1 0 1 0 1 0 1 bit initial value read/write : : : notes: 1. synchronous operation settin g is performed by settin g the sync bit in tsyr to 1. 2. when t g rc or t g rd is used as a buffer re g ister, tcnt is not cleared because the buffer re g ister settin g has priority, and compare match/input capture does not occur. tcnt cleared by counter clearin g for another channel performin g synchronous clearin g /synchronous operation * 1 tcnt cleared by counter clearin g for another channel performin g synchronous clearin g /synchronous operation * 1 10 1 0 1 0 1 tcnt clearin g disabled tcnt cleared by t g rc compare match/input capture * 2 tcnt cleared by t g rd compare match/input capture * 2 note: the internal clock ed g e selection is valid when the input clock is /4 or slower. this settin g is i g nored if /1 or overflow/underflow on another channel is selected as the input clock.
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1051 of 1108 rej09b0089-0700 tmdr0?timer mode register 0 h'ffd1 tpu0 7 ? 1 ? 6 ? 1 ? 5 bfb 0 r/w 4 bfa 0 r/w 3 md3 0 r/w 0 md0 0 r/w 2 md2 0 r/w 1 md1 0 r/w 0 1 t g rb buffer operation t g rb operates normally 0 1 t g ra buffer operation t g ra operates normally 0 1 normal operation reserved pwm mode 1 pwm mode 2 phase countin g mode 1 phase countin g mode 2 phase countin g mode 3 phase countin g mode 4 ? mode 0 1 0 1 0 1 0 1 0 1 0 1 0 1 notes: 1. 2. md3 is a reserved bit. in a write, it should always be written with 0. phase countin g mode cannot be set for channels 0 and 3. in this case, 0 should always be written to md2. : don't care bit initial value read/write : : : t g ra and t g rc used to g ether for buffer operation t g rb and t g rd used to g ether for buffer operation
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1052 of 1108 rej09b0089-0700 tior0h?timer i/o control register 0h h'ffd2 tpu0 7 iob3 0 r/w 6 iob2 0 r/w 5 iob1 0 r/w 4 iob0 0 r/w 3 ioa3 0 r/w 0 ioa0 0 r/w 2 ioa2 0 r/w 1 ioa1 0 r/w 0 1 t g r0b i/o control 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 t g r0a is output compare re g ister t g r0a i/o control 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 output disabled 0 output at compare match 1 output at compare match to gg le output at compare match 0 output at compare match 1 output at compare match to gg le output at compare match input capture at risin g ed g e input capture at fallin g ed g e input capture at both ed g es : don't care : don't care note: * when bits tpsc2 to tpsc0 in tcr1 are set to b'000, and /1 is used as the tcnt1 count clock, this settin g is invalid and input capture does not occur. bit initial value read/write : : : initial output is 0 output t g r0a is input capture re g ister output disabled initial output is 1 output capture input source is tioca0 pin capture input source is channel 1/count clock input capture at tcnt1 count-up/ count-down t g r0b is output compare re g ister output disabled 0 output at compare match 1 output at compare match to gg le output at compare match 0 output at compare match 1 output at compare match to gg le output at compare match input capture at risin g ed g e input capture at fallin g ed g e input capture at both ed g es initial output is 0 output t g r0b is input capture re g ister output disabled initial output is 0 output capture input source is tiocb0 pin capture input source is channel 1/count clock input capture at tcnt1 count-up/ count-down *
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1053 of 1108 rej09b0089-0700 tior0l?timer i/o control register 0l h'ffd3 tpu0 0 1 t g r0d i/o control 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 t g r0c i/o control 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 : don't care : don't care notes: 1. when bits tpsc2 to tpsc0 in tcr1 are set to b'000, and /1 is used as the tcnt1 count clock, this settin g is invalid and input capture does not occur. 2. when the bfb bit in tmdr0 is set to 1 and t g r0d is used as a buffer re g ister, this settin g is invalid and input capture/output compare does not occur. note: * when the bfa bit in tmdr0 is set to 1 and t g r0c is used as a buffer re g ister, this settin g is invalid and input capture/output compare does not occur. 7 iod3 0 r/w 6 iod2 0 r/w 5 iod1 0 r/w 4 iod0 0 r/w 3 ioc3 0 r/w 0 ioc0 0 r/w 2 ioc2 0 r/w 1 ioc1 0 r/w note: when t g rc or t g rd is desi g nated for buffer operation, this settin g is invalid and the re g ister operates as a buffer re g ister. bit initial value read/write : : : : t g r0c is output compare re g ister * 1 output disabled 0 output at compare match 1 output at compare match to gg le output at compare match 0 output at compare match 1 output at compare match to gg le output at compare match input capture at risin g ed g e input capture at fallin g ed g e input capture at both ed g es initial output is 0 output t g r0c is input capture re g ister * output disabled initial output is 1 output capture input source is tiocc0 pin capture input source is channel 1/count clock input capture at tcnt1 count-up/ count-down t g r0d is output compare re g ister * 2 output disabled 0 output at compare match 1 output at compare match to gg le output at compare match 0 output at compare match 1 output at compare match to gg le output at compare match input capture at risin g ed g e input capture at fallin g ed g e input capture at both ed g es initial output is 0 output t g r0d is input capture re g ister * 2 output disabled initial output is 1 output capture input source is tiocd0 pin capture input source is channel 1/count clock input capture at tcnt1 count-up/ count-down * 1
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1054 of 1108 rej09b0089-0700 tier0?timer interrupt enable register 0 h'ffd4 tpu0 7 tt g e 0 r/w 6 ? 1 ? 5 ? 0 ? 4 tciev 0 r/w 3 t g ied 0 r/w 0 t g iea 0 r/w 2 t g iec 0 r/w 1 t g ieb 0 r/w 0 1 a/d conversion start request g eneration disabled a/d conversion start request g eneration enabled a/d conversion start request enable 0 1 interrupt request (tciv) by tcfv disabled interrupt request (tciv) by tcfv enabled overflow interrupt enable t g r interrupt enable d t g r interrupt enable c t g r interrupt enable b 0 1 interrupt request (t g ia) by t g fa bit disabled t g r interrupt enable a 0 1 interrupt request (t g ib) by t g fb bit disabled 0 1 interrupt request (t g ic) by t g fc bit disabled 0 1 interrupt request (t g id) by t g fd bit disabled bit initial value read/write : : : interrupt request (t g ia) by t g fa bit enabled interrupt request (t g ib) by t g fb bit enabled interrupt request (t g ic) by t g fc bit enabled interrupt request (t g id) by t g fd bit enabled
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1055 of 1108 rej09b0089-0700 tsr0?timer status register 0 h'ffd5 tpu0 7 ? 1 ? 6 ? 1 ? 5 ? 0 ? 4 tcfv 0 r/(w) * 3 t g fd 0 r/(w) * 0 t g fa 0 r/(w) * 2 t g fc 0 r/(w) * 1 t g fb 0 r/(w) * note: * can only be written with 0 for fla g clearin g . 0 overflow fla g 1 0 input capture/output compare fla g d 1 0 input capture/output compare fla g c 1 0 input capture/output compare fla g b 1 0 [clearin g conditions] ? when dtc is activated by t g ia interrupt while disel bit of mrb in dtc is 0 ? when 0 is written to t g fa after readin g t g fa = 1 input capture/output compare fla g a 1 bit initial value read/write : : : [settin g conditions] ? when tcnt = t g ra while t g ra is functionin g as output compare re g ister ? when tcnt value is transferred to t g ra by input capture si g nal while t g ra is functionin g as input capture re g ister [clearin g conditions] ? when dtc is activated by t g ib interrupt while disel bit of mrb in dtc is 0 ? when 0 is written to t g fb after readin g t g fb = 1 [settin g conditions] ? when tcnt = t g rb while t g rb is functionin g as output compare re g ister ? when tcnt value is transferred to t g rb by input capture si g nal while t g rb is functionin g as input capture re g ister [clearin g conditions] ? when dtc is activated by t g ic interrupt while disel bit of mrb in dtc is 0 ? when 0 is written to t g fc after readin g t g fc = 1 [settin g conditions] ? when tcnt = t g rc while t g rc is functionin g as output compare re g ister ? when tcnt value is transferred to t g rc by input capture si g nal while t g rc is functionin g as input capture re g ister [clearin g conditions] ? when dtc is activated by t g id interrupt while disel bit of mrb in dtc is 0 ? when 0 is written to t g fd after readin g t g fd = 1 [settin g conditions] ? when tcnt = t g rd while t g rd is functionin g as output compare re g ister ? when tcnt value is transferred to t g rd by input capture si g nal while t g rd is functionin g as input capture re g ister [clearin g condition] when 0 is written to tcfv after readin g tcfv = 1 [settin g condition] when the tcnt value overflows (chan g es from h'ffff to h'0000 )
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1056 of 1108 rej09b0089-0700 tcnt0?timer counter 0 h'ffd6 tpu0 15 0 r/w 14 0 r/w 13 0 r/w 12 0 r/w 11 0 r/w 8 0 r/w 10 0 r/w 9 0 r/w bit initial value read/write : : : 7 0 r/w 6 0 r/w 5 0 r/w 4 0 r/w 3 0 r/w 0 0 r/w 2 0 r/w 1 0 r/w up-counter tgr0a?timer general register 0a h'ffd8 tpu0 tgr0b?timer general register 0b h'ffda tpu0 tgr0c?timer general register 0c h'ffdc tpu0 tgr0d?timer general register 0d h'ffde tpu0 15 1 r/w 14 1 r/w 13 1 r/w 12 1 r/w 11 1 r/w 8 1 r/w 10 1 r/w 9 1 r/w 7 1 r/w 6 1 r/w 5 1 r/w 4 1 r/w 3 1 r/w 0 1 r/w 2 1 r/w 1 1 r/w bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1057 of 1108 rej09b0089-0700 tcr1?timer control register 1 h'ffe0 tpu1 t c nt c l ear i n g d i sab l ed t c nt c l eared by tg ra compare match /i nput capture t c nt c l eared by tg rb compare match /i nput capture counter c l ear 0 1 0 1 0 1 0 1 c l ock e d g e * 0 1 ? count at r i s i n g ed g e count at fa lli n g ed g e count at both ed g es i nterna l c l ock : counts on / 1 i nterna l c l ock : counts on /4 i nterna l c l ock : counts on / 16 i nterna l c l ock : counts on / 6 4 e xterna l c l ock : counts on t c lk a p i n i nput e xterna l c l ock : counts on t c lk b p i n i nput i nterna l c l ock : counts on / 256 counts on t c nt 2 overf l ow / underf l ow ti me presca l er 0 1 0 1 0 1 0 1 0 1 0 1 0 1 7 ? 0 ? 6 cc l r1 0 r / w 5 cc l r0 0 r / w 4 c keg 1 0 r / w 3 c keg 0 0 r / w 0 t psc0 0 r / w 2 t psc2 0 r / w 1 t psc1 0 r / w n ote : t h i s sett i n g i s ig nored when channe l 1 i s i n phase count i n g mode . n ote : * synchronous operat i on sett i n g i s performed by sett i n g the s yn c b i t i n t s y r to 1 . b i t i n i t i a l va l ue read / wr i te : : : n ote : * t h i s sett i n g i s ig nored when channe l 1 i s i n phase count i n g mode . t he i nterna l c l ock ed g e se l ect i on i s va li d when the i nput c l ock i s /4 or s l ower . t h i s sett i n g i s ig nored i f / 1 or overf l ow / underf l ow on another channe l i s se l ected as the i nput c l ock . t c nt c l eared by counter c l ear i n g for another channe l perform i n g synchronous c l ear i n g/ synchronous operat i on *
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1058 of 1108 rej09b0089-0700 tmdr1?timer mode register 1 h'ffe1 tpu1 0 1 normal operation reserved pwm mode 1 pwm mode 2 phase countin g mode 1 phase countin g mode 2 phase countin g mode 3 phase countin g mode 4 ? mode 0 1 0 1 0 1 0 1 0 1 0 1 0 1 note: md3 is a reserved bit. in a write, it should always be written with 0. : don't care 7 ? 1 ? 6 ? 1 ? 5 ? 0 ? 4 ? 0 ? 3 md3 0 r/w 0 md0 0 r/w 2 md2 0 r/w 1 md1 0 r/w bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1059 of 1108 rej09b0089-0700 tior1?timer i/o control register 1 h'ffe2 tpu1 7 iob3 0 r/w 6 iob2 0 r/w 5 iob1 0 r/w 4 iob0 0 r/w 3 ioa3 0 r/w 0 ioa0 0 r/w 2 ioa2 0 r/w 1 ioa1 0 r/w 0 1 t g r1b i/o control 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 t g r1a i/o control : don't care 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 : don't care bit initial value read/write : : : t g r1a is output compare re g ister output disabled 0 output at compare match 1 output at compare match to gg le output at compare match 0 output at compare match 1 output at compare match to gg le output at compare match input capture at risin g ed g e input capture at fallin g ed g e input capture at both ed g es initial output is 0 output t g r1a is input capture re g ister output disabled initial output is 1 output capture input source is tioca1 pin capture input source is t g r0a compare match/ input capture input capture at g eneration of channel 0/t g r0a compare match/ input capture t g r1b is output compare re g ister output disabled 0 output at compare match 1 output at compare match to gg le output at compare match 0 output at compare match 1 output at compare match to gg le output at compare match input capture at risin g ed g e input capture at fallin g ed g e input capture at both ed g es initial output is 0 output t g r1b is input capture re g ister output disabled initial output is 1 output capture input source is tiocb1 pin capture input source is t g r0c compare match/ input capture input capture at g eneration of t g r0c compare match/input capture
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1060 of 1108 rej09b0089-0700 tier1?timer interrupt enable register 1 h'ffe4 tpu1 7 tt g e 0 r/w 6 ? 1 ? 5 tcieu 0 r/w 4 tciev 0 r/w 3 ? 0 ? 0 t g iea 0 r/w 2 ? 0 ? 1 t g ieb 0 r/w 0 1 a/d conversion start request g eneration disabled a/d conversion start request g eneration enabled a/d conversion start request enable 0 1 interrupt request (tciu) by tcfu disabled interrupt request (tciu) by tcfu enabled underflow interrupt enable t g r interrupt enable b 0 1 interrupt request (t g ia) by t g fa bit disabled t g r interrupt enable a 0 1 interrupt request (t g ib) by t g fb bit disabled 0 1 interrupt request (tciv) by tcfv disabled interrupt request (tciv) by tcfv enabled overflow interrupt enable bit initial value read/write : : : interrupt request (t g ia) by t g fa bit enabled interrupt request (t g ib) by t g fb bit enabled
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1061 of 1108 rej09b0089-0700 tsr1?timer status register 1 h'ffe5 tpu1 7 tcfd 1 r 6 ? 1 ? 5 tcfu 0 r/(w) * 4 tcfv 0 r/(w) * 3 ? 0 ? 0 t g fa 0 r/(w) * 2 ? 0 ? 1 t g fb 0 r/(w) * 0 1 tcnt counts down tcnt counts up count direction fla g 0 underflow fla g 1 0 overflow fla g 1 0 input capture/output compare fla g b 1 0 [clearin g conditions] ? when dtc is activated by t g ia interrupt while disel bit of mrb in dtc is 0 ? when 0 is written to t g fa after readin g t g fa = 1 input capture/output compare fla g a 1 note: * can only be written with 0 for fla g clearin g . bit initial value read/write : : : [settin g conditions] ? when tcnt = t g ra while t g ra is functionin g as output compare re g ister ? when tcnt value is transferred to t g ra by input capture si g nal while t g ra is functionin g as input capture re g ister [clearin g conditions] ? when dtc is activated by t g ib interrupt while disel bit of mrb in dtc is 0 ? when 0 is written to t g fb after readin g t g fb = 1 [settin g conditions] ? when tcnt = t g rb while t g rb is functionin g as output compare re g ister ? when tcnt value is transferred to t g rb by input capture si g nal while t g rb is functionin g as input capture re g ister [clearin g condition] when 0 is written to tcfv after readin g tcfv = 1 [settin g condition] when the tcnt value overflows (chan g es from h'ffff to h'0000 ) [clearin g condition] when 0 is written to tcfu after readin g tcfu = 1 [settin g condition] when the tcnt value underflows (chan g es from h'0000 to h'ffff)
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1062 of 1108 rej09b0089-0700 tcnt1?timer counter 1 h'ffe6 tpu1 15 0 r/w 14 0 r/w 13 0 r/w 12 0 r/w 11 0 r/w 8 0 r/w 10 0 r/w 9 0 r/w 7 0 r/w 6 0 r/w 5 0 r/w 4 0 r/w 3 0 r/w 0 0 r/w 2 0 r/w 1 0 r/w note: * up/down-counter * bit initial value read/write : : : this timer counter can be used as an up/down-counter only in phase countin g mode or when performin g overflow/underflow countin g on another channel. in other cases it functions as an up-counter. tgr1a?timer general register 1a h'ffe8 tpu1 tgr1b?timer general register 1b h'ffea tpu1 15 1 r/w 14 1 r/w 13 1 r/w 12 1 r/w 11 1 r/w 8 1 r/w 10 1 r/w 9 1 r/w 7 1 r/w 6 1 r/w 5 1 r/w 4 1 r/w 3 1 r/w 0 1 r/w 2 1 r/w 1 1 r/w bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1063 of 1108 rej09b0089-0700 tcr2?timer control register 2 h'fff0 tpu2 tcnt clearin g disabled tcnt cleared by t g ra compare match/input capture tcnt cleared by t g rb compare match/input capture counter clear 0 1 0 1 0 1 0 1 clock ed g e * 0 1 ? count at risin g ed g e count at fallin g ed g e count at both ed g es internal clock: counts on /1 internal clock: counts on /4 internal clock: counts on /16 internal clock: counts on /64 external clock: counts on tclka pin input external clock: counts on tclkb pin input external clock: counts on tclkc pin input internal clock: counts on /1024 time prescaler 0 1 0 1 0 1 0 1 0 1 0 1 0 1 7 ? 0 ? 6 cclr1 0 r/w 5 cclr0 0 r/w 4 cke g 1 0 r/w 3 cke g 0 0 r/w 0 tpsc0 0 r/w 2 tpsc2 0 r/w 1 tpsc1 0 r/w note: this settin g is i g nored when channel 2 is in phase countin g mode. note: * synchronous operation settin g is performed by settin g the sync bit in tsyr to 1. bit initial value read/write : : : note: * this settin g is i g nored when channel 2 is in phase countin g mode. the internal clock ed g e selection is valid when the input clock is /4 or slower. this settin g is i g nored if /1 or overflow/underflow on another channel is selected as the input clock. tcnt cleared by counter clearin g for another channel performin g synchronous clearin g /synchronous operation *
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1064 of 1108 rej09b0089-0700 tmdr2?timer mode register 2 h'fff1 tpu2 0 1 normal operation reserved pwm mode 1 pwm mode 2 phase countin g mode 1 phase countin g mode 2 phase countin g mode 3 phase countin g mode 4 ? mode 0 1 0 1 0 1 0 1 0 1 0 1 0 1 note: md3 is a reserved bit. in a write, it should always be written with 0. : don't care 7 ? 1 ? 6 ? 1 ? 5 ? 0 ? 4 ? 0 ? 3 md3 0 r/w 0 md0 0 r/w 2 md2 0 r/w 1 md1 0 r/w bit initial value read/write : : :
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1065 of 1108 rej09b0089-0700 tior2?timer i/o control register 2 h'fff2 tpu2 7 iob3 0 r/w 6 iob2 0 r/w 5 iob1 0 r/w 4 iob0 0 r/w 3 ioa3 0 r/w 0 ioa0 0 r/w 2 ioa2 0 r/w 1 ioa1 0 r/w 0 1 t g r2b i/o control 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 : don't care 0 1 t g r2a is output compare re g ister t g r2a i/o control 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 output at compare match 1 output at compare match to gg le output at compare match 0 output at compare match 1 output at compare match to gg le output at compare match input capture at risin g ed g e input capture at fallin g ed g e input capture at both ed g es : don't care bit initial value read/write : : : output disabled initial output is 0 output output disabled initial output is 1 output t g r2a is input capture re g ister capture input source is tioca2 pin t g r2b is output compare re g ister 0 output at compare match 1 output at compare match to gg le output at compare match 0 output at compare match 1 output at compare match to gg le output at compare match input capture at risin g ed g e input capture at fallin g ed g e input capture at both ed g es output disabled initial output is 0 output output disabled initial output is 1 output t g r2b is input capture re g ister capture input source is tiocb2 pin
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1066 of 1108 rej09b0089-0700 tier2?timer interrupt enable register 2 h'fff4 tpu2 7 tt g e 0 r/w 6 ? 1 ? 5 tcieu 0 r/w 4 tciev 0 r/w 3 ? 0 ? 0 t g iea 0 r/w 2 ? 0 ? 1 t g ieb 0 r/w 0 1 a/d conversion start request g eneration disabled a/d conversion start request g eneration enabled a/d conversion start request enable 0 1 interrupt request (tciu) by tcfu disabled interrupt request (tciu) by tcfu enabled underflow interrupt enable t g r interrupt enable b 0 1 interrupt request (t g ia) by t g fa bit disabled t g r interrupt enable a 0 1 interrupt request (t g ib) by t g fb bit disabled 0 1 interrupt request (tciv) by tcfv disabled interrupt request (tciv) by tcfv enabled overflow interrupt enable bit initial value read/write : : : interrupt request (t g ia) by t g fa bit enabled interrupt request (t g ib) by t g fb bit enabled
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1067 of 1108 rej09b0089-0700 tsr2?timer status register 2 h'fff5 tpu2 7 tcfd 1 r 6 ? 1 ? 5 tcfu 0 r/(w) * 4 tcfv 0 r/(w) * 3 ? 0 ? 0 t g fa 0 r/(w) * 2 ? 0 ? 1 t g fb 0 r/(w) * 0 1 tcnt counts down tcnt counts up count direction fla g 0 underflow fla g 1 0 overflow fla g 1 0 input capture/output compare fla g b 1 0 [clearin g conditions] ? when dtc is activated by t g ia interrupt while disel bit of mrb in dtc is 0 ? when 0 is written to t g fa after readin g t g fa = 1 input capture/output compare fla g a 1 note: * can only be written with 0 for fla g clearin g . bit initial value read/write : : : [settin g conditions] ? when tcnt = t g ra while t g ra is functionin g as output compare re g ister ? when tcnt value is transferred to t g ra by input capture si g nal while t g ra is functionin g as input capture re g ister [clearin g conditions] ? when dtc is activated by t g ib interrupt while disel bit of mrb in dtc is 0 ? when 0 is written to t g fb after readin g t g fb = 1 [settin g conditions] ? when tcnt = t g rb while t g rb is functionin g as output compare re g ister ? when tcnt value is transferred to t g rb by input capture si g nal while t g rb is functionin g as input capture re g ister [clearin g condition] when 0 is written to tcfv after readin g tcfv = 1 [settin g condition] when the tcnt value overflows (chan g es from h'ffff to h'0000 ) [clearin g condition] when 0 is written to tcfu after readin g tcfu = 1 [settin g condition] when the tcnt value underflows (chan g es from h'0000 to h'ffff)
appendix b internal i/o registers rev.7.00 feb. 14, 2007 page 1068 of 1108 rej09b0089-0700 tcnt2?timer counter 2 h'fff6 tpu2 15 0 r/w 14 0 r/w 13 0 r/w 12 0 r/w 11 0 r/w 8 0 r/w 10 0 r/w 9 0 r/w 7 0 r/w 6 0 r/w 5 0 r/w 4 0 r/w 3 0 r/w 0 0 r/w 2 0 r/w 1 0 r/w note: * this timer counter can be used as an up/down-counter only in phase countin g mode or when performin g overflow/underflow countin g on another channel. in other cases it functions as an up-counter. up/down-counter * bit initial value read/write : : : tgr2a?timer general register 2a h'fff8 tpu2 tgr2b?timer general register 2b h'fffa tpu2 15 1 r/w 14 1 r/w 13 1 r/w 12 1 r/w 11 1 r/w 8 1 r/w 10 1 r/w 9 1 r/w 7 1 r/w 6 1 r/w 5 1 r/w 4 1 r/w 3 1 r/w 0 1 r/w 2 1 r/w 1 1 r/w bit initial value read/write : : :
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1069 of 1108 rej09b0089-0700 appendix c i/o port block diagrams c.1 port 1 r p1nddr c qd reset wddr1 reset wdr1 modes 4 to 6 r p1ndr c qd p1n rdr1 rpor1 internal address bus internal data bus bus controller tpu module ame bit output compare output / pwm output enable output compare output / pwm output input capture input legend: wddr1: write to p1ddr wdr1: write to p1dr rdr1: read p1dr rpor1: read port 1 ame: address m enable notes: n = 0 or 1 m = 20 or 21 figure c.1(a) port 1 block diagram (pins p10 and p11)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1070 of 1108 rej09b0089-0700 r p1nddr c qd reset wddr1 reset wdr1 modes 4 to 6 r p1ndr c qd p1n rdr1 rpor1 internal data bus internal address bus bus controller tpu module ame bit output compare output / pwm output enable output compare output / pwm output external clock input input capture input legend: wddr1: write to p1ddr wdr1: write to p1dr rdr1: read p1dr rpor1: read port 1 ame: address m enable notes: n = 2 or 3 m = 22 or 23 figure c.1(b) port 1 block diagram (pins p12 and p13)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1071 of 1108 rej09b0089-0700 r p1nddr c qd reset wddr1 reset wdr1 r p1ndr c qd p1n rdr1 rpor1 internal data bus tpu module output compare output / pwm output enable output compare output / pwm output input capture input legend: wddr1: write to p1ddr wdr1: write to p1dr rdr1: read p1dr rpor1: read port 1 note: n = 4 or 6 figure c.1(c) port 1 block diagram (pins p14 and p16)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1072 of 1108 rej09b0089-0700 r p1nddr c qd reset wddr1 reset wdr1 r p1ndr c qd p1n rdr1 rpor1 internal data bus tpu module output compare output / pwm output enable output compare output / pwm output external clock input input capture input legend: wddr1: write to p1ddr wdr1: write to p1dr rdr1: read p1dr rpor1: read port 1 note: n = 5 or 7 figure c.1(d) port 1 block diagram (pins p15 and p17)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1073 of 1108 rej09b0089-0700 c.2 port 2 r p2nddr c qd reset wddr2 reset wdr2 r p2ndr c qd p2n rdr2 rpor2 tpu module output compare output / pwm output enable output compare output / pwm output input capture input internal data bus legend: wddr2: write to p2ddr wdr2: write to p2dr rdr2: read p2dr rpor2: read port 2 note: n = 0 to 7 figure c.2 port 2 block diagram (pins p20 to p27)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1074 of 1108 rej09b0089-0700 c.3 port 3 r p3nddr c qd reset wddr3 reset wdr3 r c qd p3n rdr3 rodr3 rpor3 internal data bus sci module serial transmit enable serial transmit data p3ndr reset wodr3 r c qd p3nodr * 1 * 2 legend: wddr3: write to p3ddr wdr3: write to p3dr wodr3: write to p3odr rdr3: read p3dr rpor3: read port 3 rodr3: read p3odr notes: n = 0 or 1 1. output enable signal 2. open drain control signal figure c.3(a) port 3 block diagram (pins p30 and p31)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1075 of 1108 rej09b0089-0700 r p3nddr c qd reset wddr3 reset wdr3 r c qd p3n rdr3 rodr3 rpor3 internal data bus sci module serial receive data enable serial receive data p3ndr reset wodr3 r c qd p3nodr * 1 * 2 legend: wddr3: write to p3ddr wdr3: write to p3dr wodr3: write to p3odr rdr3: read p3dr rpor3: read port 3 rodr3: read p3odr notes: n = 2 or 3 1. output enable signal 2. open drain control signal figure c.3(b) port 3 block diagram (pins p32 and p33)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1076 of 1108 rej09b0089-0700 r p3nddr c qd reset wddr3 reset wdr3 r c qd p3n rdr3 rodr3 rpor3 internal data bus sci module serial clock output enable interrupt controller irq interrupt input p3ndr reset wodr3 r c qd p3nodr * 1 * 2 serial clock input legend: wddr3: write to p3ddr wdr3: write to p3dr wodr3: write to p3odr rdr3: read p3dr rpor3: read port 3 rodr3: read p3odr notes: n = 4 or 5 1. output enable signal 2. open drain control signal serial clock output serial clock input enable figure c.3(c) port 3 block diagram (pins p34 and p35)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1077 of 1108 rej09b0089-0700 c.4 port 4 p4n rpor4 internal data bus a/d converter module analog input legend: rpor4: read port 4 note: n = 0 to 5 figure c.4(a) port 4 block diagram (pins p40 to p45) legend: rpor4: read port 4 note: n = 6 or 7 p4n rpor4 internal data bus a/d converter module analog input d/a converter module output enable analog output figure c.4(b) port 4 block diagram (pins p46 and p47)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1078 of 1108 rej09b0089-0700 c.5 port a r panpcr c qd reset wpcra reset wdra r c qd pan rdra rodra rpora internal address bus pandr reset wddra r modes 6 and 7 modes 4 and 5 c qd panddr reset wodra rpcra r c qd panodr * 1 * 2 mode 7 modes 4 to 6 internal data bus legend: wddra: write to paddr wdra: write to padr wodra: write to paodr wpcra: write to papcr rdra: read padr rpora: read port a rodra: read paodr rpcra: read papcr notes: n = 0 to 3 1. output enable signal 2. open drain control signal figure c.5 port a block diagram (pins pa0 to pa3)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1079 of 1108 rej09b0089-0700 c.6 port b r pbnpcr c qd reset wpcrb reset wdrb r c qd pbn rdrb rporb internal address bus pbndr reset wddrb r c qd pbnddr rpcrb mode 7 modes 4 to 6 internal data bus modes 4 and 5 modes 6 and 7 legend: wddrb: write to pbddr wdrb: write to pbdr wpcrb: write to pbpcr rdrb: read pbdr rporb: read port b rpcrb: read pbpcr note: n = 0 to 7 figure c.6 port b block diagram (pins pb0 to pb7)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1080 of 1108 rej09b0089-0700 c.7 port c r pcnpcr c qd reset wpcrc reset wdrc r c qd pcn rdrc rporc internal address bus pcndr reset wddrc r c qd pcnddr rpcrc mode 7 modes 4 to 6 internal data bus modes 4 and 5 modes 6 and 7 legend: wddrc: write to pcddr wdrc: write to pcdr wpcrc: write to pcpcr rdrc: read pcdr rporc: read port c rpcrc: read pcpcr note: n = 0 to 7 figure c.7 port c block diagram (pins pc0 to pc7)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1081 of 1108 rej09b0089-0700 c.8 port d r pdnpcr c qd reset wpcrd reset wdrd r c qd pdn rdrd rpord external address upper write pdndr wddrd c qd pdnddr rpcrd mode 7 modes 4 to 6 external address write modes 4 to 6 mode 7 reset r external address upper read external address lower read internal upper data bus internal lower data bus legend: wddrd: write to pdddr wdrd: write to pddr wpcrd: write to pdpcr rdrd: read pddr rpord: read port d rpcrd: read pdpcr note: n = 0 to 7 external address lower write figure c.8 port d block diagram (pins pd0 to pd7)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1082 of 1108 rej09b0089-0700 c.9 port e r penpcr c qd reset wpcre reset wdre r c qd pen rdre rpore pendr wddre c qd penddr rpcre modes 4 to 6 reset r external address lower read internal upper data bus internal lower data bus external address write 8-bit bus mode mode 7 bus controlle r modes 4 to 6 legend: wddre: write to peddr wdre: write to pedr wpcre: write to pepcr rdre: read pedr rpore: read port e rpcre: read pepcr note: n = 0 to 7 figure c.9 port e block diagram (pins pe0 to pe7)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1083 of 1108 rej09b0089-0700 c.10 port f r pf0ddr c qd reset wddrf reset wdrf r c qd pf0 rdrf rporf bus request input pf0dr bus controller brle bit chip select interrupt controller irq interrupt input port cs25e bit pf0cs4s bit modes 4 to 6 internal data bus legend: wddrf: write to pfddr wdrf: write to pfdr rdrf: read pfdr rporf: read port f cs25e: cs25 enable pf0cs4s: port f0 chip select 4 select brle: bus release enable figure c.10(a) port f block diagram (pin pf0)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1084 of 1108 rej09b0089-0700 legend: wddrf: write to pfddr wdrf: write to pfdr rdrf: read pfdr rporf: read port f cs25e: cs25 enable pf1cs5s: port f1 chip select 5 select brle: bus release enable r pf1ddr c qd reset wddrf modes 4 to 6 reset wdrf r pf1dr c qd pf1 rdrf rporf bus controller brle bit chip select internal data bus bus request acknowledge output port cs25e bit pf1cs5s bit interrupt controller irq interrupt input figure c.10(b) port f block diagram (pin pf1)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1085 of 1108 rej09b0089-0700 r pf2ddr c qd reset wddrf reset wdrf r pf2dr c qd pf2 rdrf rporf bus request output enable wait enable wait input irq interupt input bus controller interrupt controller modes 4 to 6 modes 4 to 6 internal data bus legend: wddrf: write to pfddr wdrf: write to pfdr rdrf: read pfdr rporf: read port f bus request output figure c.10(c) port f block diagram (pin pf2)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1086 of 1108 rej09b0089-0700 r pf3ddr c qd reset wddrf reset wdrf r pf3dr c qd pf3 rdrf rporf bus controller lwr output interrupt controller irq interrupt input lwrod bit mode 7 modes 4 to 6 internal data bus modes 4 to 6 legend: wddrf: write to pfddr wdrf: write to pfdr rdrf: read pfdr rporf: read port f lwrod: lwr output disable figure c.10(d) port f block diagram (pin pf3)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1087 of 1108 rej09b0089-0700 r pf4ddr c qd reset wddrf reset wdrf r pf4dr c qd pf4 rdrf rporf bus controlle r hwr output modes 4 to 6 modes 4 to 6 mode 7 internal data bus legend: wddrf: write to pfddr wdrf: write to pfdr rdrf: read pfdr rporf: read port f figure c.10(e) port f block diagram (pin pf4)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1088 of 1108 rej09b0089-0700 r pf5ddr c qd reset wddrf reset wdrf r pf5dr c qd pf5 rdrf rporf bus controlle r rd output modes 4 to 6 modes 4 to 6 mode 7 internal data bus legend: wddrf: write to pfddr wdrf: write to pfdr rdrf: read pfdr rporf: read port f figure c.10(f) port f block diagram (pin pf5)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1089 of 1108 rej09b0089-0700 r pf6ddr c qd reset wddrf modes 4 to 6 modes 4 to 6 mode 7 reset wdrf r pf6dr c q d pf6 rdrf rporf bus controlle r as output internal data bus asod bit legend: wddrf: write to pfddr wdrf: write to pfdr rdrf: read pfdr rporf: read port f asod: as output disable figure c.10(g) port f block diagram (pin pf6)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1090 of 1108 rej09b0089-0700 d wddrf reset reset wdrf r pf7dr c qd pf7 rdrf rporf r s c qd pf7ddr internal data bus modes 4 to 6 mode 7 legend: wddrf: write to pfddr wdrf: write to pfdr rdrf: read pfdr rporf: read port f figure c.10(h) port f block diagram (pin pf7)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1091 of 1108 rej09b0089-0700 c.11 port g r pg0ddr c qd reset wddrg reset wdrg r pg0dr c qd pg0 rdrg rporg a/d convereter a/d converter external trigger input interrput controller irq interrupt input internal data bus legend: wddrg: write to pgddr wdrg: write to pgdr rdrg: read pgdr rporg: read port g figure c.11(a) port g block diagram (pin pg0)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1092 of 1108 rej09b0089-0700 r pg1ddr c qd reset wddrg reset wdrg r pg1dr c qd pg1 rdrg rporg bus controller chip select 3 chip select 6 port cs167e bit cs25e bit css36 bit mode 7 internal data bus modes 4 to 6 legend: wddrg: write to pgddr wdrg: write to pgdr rdrg: read pgdr rporg: read port g cs25e: cs25 enable cs167e: cs167 enable css36: cs36 select figure c.11(b) port g block diagram (pin pg1)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1093 of 1108 rej09b0089-0700 r pg2ddr c qd reset wddrg reset wdrg r pg2dr c qd pg2 rdrg rporg bus controller port chip select 2 mode 7 internal data bus cs25e bit modes 4 to 6 legend: wddrg: write to pgddr wdrg: write to pgdr rdrg: read pgdr rporg: read port g cs25e: cs25 enable figure c.11(c) port g block diagram (pin pg2)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1094 of 1108 rej09b0089-0700 legend: wddrg: write to pgddr wdrg: write to pgdr rdrg: read pgdr rporg: read port g cs167e: cs167 enable css17: cs17 select r pg3ddr c qd reset wddrg reset wdrg r pg3dr c qd pg3 rdrg rporg bus controller chip select 1 chip select 7 port cs167e bit css17 bit mode 7 internal data bus modes 4 to 6 figure c.11(d) port g block diagram (pin pg3)
appendix c i/o port block diagrams rev.7.00 feb. 14, 2007 page 1095 of 1108 rej09b0089-0700 qd wddrg reset reset wdrg r pg4dr c qd pg4 rdrg rporg bus controller chip select 0 mode 7 modes 4 to 6 modes 4 and 5 modes 6 and 7 d sr c q pg4ddr internal data bus legend: wddrg: write to pgddr wdrg: write to pgdr rdrg: read pgdr rporg: read port g d figure c.11(e) port g block diagram (pin pg4)
appendix d pin states rev.7.00 feb. 14, 2007 page 1096 of 1108 rej09b0089-0700 appendix d pin states d.1 port states in each mode table d.1 i/o port states in each processing state port name pin name mcu operating mode reset hardware standby mode software standby mode bus-released state program execution state sleep mode p17/tiocb2/ tclkd p16/tioca2 p15/tiocb1/ tclkc p14/tioca1 4 to 7 t t kept kept i/o port p13/tiogd0/ tclkb/a23 p12/tiocc0/t clka/a22 p11/tiocb0/ a21 p10/tioca0/ a20 4 to 6 t t [ane = 0] kept [ane ddr = 1] kept [ane ddr ope = 1] t [ane ddr ope = 1] kept [ane = 0] kept [ane ddr = 1] kept [ane ddr = 1] t [ane = 0] i/o port [ane ddr = 1] i/o port [ane ddr = 1] address output 7 t t kept kept i/o port port 2 4 to 7 t t kept kept i/o port port 3 4 to 7 t t kept kept i/o port p47/da1 4 to 7 t t [daoe1 = 1] kept [daoe1 = 0] t kept i/o port p46/da0 4 to 7 t t [daoe0 = 1] kept [daoe0 = 0] t kept i/o port p45 to p40 4 to 7 t t t t input port
appendix d pin states rev.7.00 feb. 14, 2007 page 1097 of 1108 rej09b0089-0700 port name pin name mcu operating mode reset hardware standby mode software standby mode bus-released state program execution state sleep mode pa3/a19 pa2/a18 pa1/a17 pa0/a16 4, 5 l t [ope = 0] t [ope = 1] kept t address output 6 t t [ddr ope = 0] t [ddr ope = 1] kept t [ddr = 0] input port [ddr = 1] address output 7 t t kept kept i/o port port b 4, 5 l t [ope = 0] t [ope = 1] kept t address output 6 t t [ddr ope = 0] t [ddr ope = 1] kept t [ddr = 0] input port [ddr = 1] address output 7 t t kept kept i/o port port c 4, 5 l t [ope = 0] t [ope = 1] kept t address output 6 t t [ddr ope = 0] t [ddr ope = 1] kept t [ddr = 0] input port [ddr = 1] address output 7 t t kept kept i/o port port d 4 to 6 t t t t data bus 7 t t kept kept i/o port port e 4 to 6 8-bit bus t t kept kept i/o port 16-bit bus t t t t data bus 7 t t kept kept i/o port
appendix d pin states rev.7.00 feb. 14, 2007 page 1098 of 1108 rej09b0089-0700 port name pin name mcu operating mode reset hardware standby mode software standby mode bus-released state program execution state sleep mode pf7 / 4 to 6 clock output t [ddr = 0] input port [ddr = 1] h [ddr = 0] input port [ddr = 1] clock output [ddr = 0] input port [ddr = 1] clock output 7 t t [ddr = 0] input port [ddr = 1] h [ddr = 0] input port [ddr = 1] clock output [ddr = 0] input port [ddr = 1] clock output pf6/ as 4 to 6 h t [asod = 1] kept [ asod ope = 1] t [ asod ope = 1] h [asod = 1] kept [asod = 0] t [asod = 1] i/o port [asod = 0] as 7 t t kept kept i/o port pf5/ rd pf4/ hwr 4 to 6 h t [ope = 0] t [ope = 1] h t rd , hwr 7 t t kept kept i/o port pf3/ lwr / irq3 4 to 6 h t [lwrod = 1] kept [ lwrod ope = 1] t [ lwrod ope = 1] h [lwrod = 1] kept [lwrod = 0] t [lwrod = 1] i/o port [lwrod = 0] lwr 7 t t kept kept i/o port pf2/ wait / irq2 / breqo 4 to 6 t t [breqoe + waite = 0] kept [breqoe = 1] kept [breqoe = 0] and [waite ddr = 1] t [breqoe + waite = 0] kept [breqoe = 1] breqo [breqoe = 0] and [waite ddr = 1] t [breqoe + waite = 0] i/o port [breqoe = 1] breqo [breqoe = 0] and [waite ddr = 1] wait 7 t t kept kept i/o port
appendix d pin states rev.7.00 feb. 14, 2007 page 1099 of 1108 rej09b0089-0700 port name pin name mcu operating mode reset hardware standby mode software standby mode bus-released state program execution state sleep mode pf1/ back / irq1 / cs5 4 to 6 t t [brle + cs25e pf1cs5s = 0] kept [ brle ddr cs25e pf1cs5s =1] and [ope = 0] t [ brle ddr cs25e pf1cs5s = 1] and [ope = 1] h [brle = 1] back l [brle + cs25e pf1cs5s = 0] i/o port [ brle ddr cs25e pf1cs5s =1] cs5 [brle = 1] back 7 t t kept kept i/o port pf0/ breq / irq0 / cs4 4 to 6 t t [brle + cs25e pf0cs4s = 0] kept [ brle ddr cs25e pf0cs4s = 1] and [ope = 0] t [ brle ddr cs25e pf0cs4s = 1] and [ope = 1] h [brle = 1] t t [brle + cs25e pf0cs4s = 0] i/o port [ brle ddr cs25e pf0cs4s = 1] cs4 [brle = 1] breq 7 t t kept kept i/o port
appendix d pin states rev.7.00 feb. 14, 2007 page 1100 of 1108 rej09b0089-0700 port name pin name mcu operating mode reset hardware standby mode software standby mode bus-released state program execution state sleep mode pg4/ cs0 4, 5 h t [ddr ope = 0] t t [ddr = 0] input port 6 t [ddr ope = 1] h [ddr = 1] cs0 7 t t kept kept i/o port pg3/ cs1 / cs7 4 to 6 t t [cs167e = 0] kept [cs167e ddr = 1] t [cs167e ddr ope = 1] t [cs167e ddr ope = 1] h [cs167e = 0] kept [cs167e = 1] t [cs167e = 0] i/o port [cs167e ddr = 1] input port [cs167e css17 ddr = 1] cs1 [cs167e css17 ddr = 1] cs7 7 t t kept kept i/o port pg2/ cs2 4 to 6 t t [cs25e = 0] kept [cs25e ddr = 1] t [cs25e ddr ope = 1] t [cs25e ddr ope = 1] h [cs25e = 0] kept [cs25e = 1] t [cs25e = 0] i/o port [cs25e ddr = 1] input port [cs25e ddr = 1] cs2 7 t t kept kept i/o port
appendix d pin states rev.7.00 feb. 14, 2007 page 1101 of 1108 rej09b0089-0700 port name pin name mcu operating mode reset hardware standby mode software standby mode bus-released state program execution state sleep mode pg1/ cs3 / cs6 / irq7 4 to 6 t t [ css36 cs25e + css36 cs167e = 0] kept [ css36 cs25e ddr = 1] t [css36 cs167e ddr = 1] t [ css36 cs25e ddr ope = 1] t [css36 cs167e ddr ope = 1] t [ css36 cs25e ddr ope = 1] h [css36 cs167e ddr ope = 1] h [ css36 cs25e + css36 cs167e = 0] kept [ css36 cs25e + css36 cs167e = 1] t [ css36 cs25e + css36 cs167e = 0] i/o port [ css36 cs25e ddr = 1] input port [css36 cs167e ddr = 1] input port [ css36 cs25e ddr = 1] cs3 [css36 cs167e ddr = 1] cs6 7 t t kept kept i/o port pg0/ adtrg / irq6 4 to 7 t t kept kept i/o port wdtovf * 1 4 to 7 h h h h h * 2 legend: h: high level l: low level t: high impedance kept: input port becomes high-impedance, output port retains state ddr: data direction register ope: output port enable waite: wait input enable brle: bus release enable breqoe: breqo pin enable ane: address n enable (n = 23 to 20) asod: as output disable cs167e: cs167 enable cs25e: cs25 enable
appendix d pin states rev.7.00 feb. 14, 2007 page 1102 of 1108 rej09b0089-0700 css36: cs36 select css17: cs17 select pf1cs5s: port f1 chip select 5 select pf0cs4s: port f0 chip select 4 select lwrod: lwr output disable daoen: d/a output enable n (n = 0, 1) notes: 1. the wdtovf pin function is not usable on the f-ztat version. 2. a low level is output if a wdt overflow occurs while wt/ it is set to 1.
appendix e product lineup rev.7.00 feb. 14, 2007 page 1103 of 1108 rej09b0089-0700 appendix e product lineup table e.1 h8s/2319 group product lineup product type part no. marking package (package code) h8s/2319 mask rom version hd6432319 hd6432319te 100-pin tqfp (tfp-100b) hd6432319f 100-pin qfp (fp-100a) f-ztat version hd64f2319 hd64f2319vte 100-pin tqfp (tfp-100b) hd64f2319vf 100-pin qfp (fp-100a) hd64f2319e * 1 hd64f2319evte 100-pin tqfp (tfp-100b) hd64f2319evf 100-pin qfp (fp-100a) hd64f2319c hd64f2319cvte 100-pin tqfp (tfp-100b) hd64f2319cvf 100-pin qfp (fp-100a) hd64f2319clp 113-pin lga (tlp-113v) h8s/2318 mask rom version hd6432318 hd6432318te 100-pin tqfp (tfp-100b) hd6432318f 100-pin qfp (fp-100a) f-ztat version hd64f2318 hd64f2318vte 100-pin tqfp (tfp-100b) hd64f2318vtf 100-pin tqfp (tfp-100g) hd64f2318vf 100-pin qfp (fp-100a) h8s/2317(s) * 2 mask rom version hd6432317s hd64f2317ste 100-pin tqfp (tfp-100b) hd6432317stf 100-pin tqfp (tfp-100g) hd64f2317sf 100-pin qfp (fp-100a) hd6432317slp 113-pin lga (tlp-113v) f-ztat version hd64f2317 hd64f2317vte 100-pin tqfp (tfp-100b) hd64f2317vtf 100-pin tqfp (tfp-100g) hd64f2317vf 100-pin qfp (fp-100a) h8s/2316s mask rom version hd6432316s hd6432316te 100-pin tqfp (tfp-100b) hd6432316stf 100-pin tqfp (tfp-100g) hd6432316f 100-pin qfp (fp-100a) hd6432316slp 113-pin lga (tlp-113v) h8s/2315 mask rom version hd6432315 hd6432315vte 100-pin tqfp (tfp-100b) hd6432315ve 100-pin qfp (fp-100a) f-ztat version hd64f2315 hd64f2315vte 100-pin tqfp (tfp-100b) hd64f2315vf 100-pin qfp (fp-100a)
appendix e product lineup rev.7.00 feb. 14, 2007 page 1104 of 1108 rej09b0089-0700 product type part no. marking package (package code) h8s/2314 mask rom version hd6432314 hd6432314vte 100-pin tqfp (tfp-100b) hd6432314ve 100-pin qfp (fp-100a) f-ztat version hd64f2314 hd64f2314vte 100-pin tqfp (tfp-100b) hd64f2314vf 100-pin qfp (fp-100a) h8s/2312s romless version hd6412312s hd6412312svte 100-pin tqfp (tfp-100b) hd6412312svf 100-pin qfp (fp-100a) notes: 1. the on-chip debug function can be used with the e10a emulator (e10a compatible version). 2. h8s/2317s in mask rom version.
appendix f package dimensions rev.7.00 feb. 14, 2007 page 1105 of 1108 rej09b0089-0700 appendix f package dimensions note) 1. dimensions" * 1"and" * 2" do not include mold flash 2. dimension" * 3"does not include trim offset. ptqp0100ka-a p-tqfp100-14x14-0.50 1.00 1.00 0.08 0.10 0.5 8 ? 0 ? 15.8 16.0 16.2 0.15 0.20 1.20 0.20 0.10 0.00 0.27 0.22 0.17 0.22 0.17 0.12 1 e d 1 1 p 1 e d 2 l z z y x c b b a h a e d a c e e l h mass[typ.] 0.5g tfp-100b/tfp-100bv renesas code jeita package code previous code 0.6 0.5 0.4 max nom min dimension in millimeters symbol reference 14 1.00 16.2 16.0 15.8 1.0 14 index mark * 1 * 2 * 3 p e d e d 100 1 f xm y 26 25 76 75 50 51 z z h e h d b 2 1 1 detail f c l a a a l terminal cross section p 1 1 b c b c figure f.1 tfp-100b package dimensions
appendix f package dimensions rev.7.00 feb. 14, 2007 page 1106 of 1108 rej09b0089-0700 note) 1. dimensions" * 1"and" * 2" do not include mold flash 2. dimension" * 3"does not include trim offset. index mark * 1 * 2 * 3 p e d e d ymx f 100 125 26 76 75 50 51 e h d h b z z 2 1 1 detail f c a a l a l terminal cross section 1 1 p b c c b ptqp0100lc-a p-tqfp100-12x12-0.40 h l e e c a d e a h a b b c x y z z l 2 d e 1 p 1 1 d e 1 mass[typ.] 0.4g reference symbol dimension in millimeters min nom max previous code jeita package code renesas code tfp-100g/tfp-100gv 1.0 0.10 0 ? 8 ? 0.4 0.12 0.17 0.22 0.13 0.18 0.23 0.00 0.10 0.20 1.20 13.8 14.0 14.2 1.00 12 0.16 0.15 0.4 0.5 0.6 0.07 14.2 14.0 13.8 1.2 12 1.2 figure f.2 tfp-100g package dimensions
appendix f package dimensions rev.7.00 feb. 14, 2007 page 1107 of 1108 rej09b0089-0700 note) 1. dimensions" * 1"and" * 2" do not include mold flash 2. dimension" * 3"does not include trim offset. prqp0100je-b p-qfp100-14x20-0.65 0.83 0.58 0.15 0.13 0.65 10 ? 0 ? 19.2 18.8 18.4 3.10 0.12 0.17 0.22 0.24 0.32 0.40 0.00 0.30 0.15 0.20 0.30 20 14 l d 1 e d 1 1 p 1 e d 2 z z y x c b b a h a e a c e e l h 1.7g mass[typ.] 2.4 24.4 24.8 25.2 2.70 reference symbol dimension in millimeters min nom max 1.0 1.2 1.4 previous code jeita package code renesas code fp-100a/fp-100av * 1 * 2 * 3 p e d e d 51 50 80 81 30 31 1 100 f ymx z z b h e h d 2 1 1 detail f c l aa a l terminal cross section p 1 1 b c b c figure f.3 fp-100a package dimensions
appendix f package dimensions rev.7.00 feb. 14, 2007 page 1108 of 1108 rej09b0089-0700 b a s b a b ws a ws s ys 1 ys v x4 k j h g f e d c b a 10 9 8 7 6 5 4 3 2 1 d e l 11 z e z e b a e d e a 1 max nom min dimension in millimeters symbol reference a b x y 8.0 0.10 0.65 0.30 0.35 0.40 1.2 8.0 0.08 v w 0.75 0.75 y 1 0.20 0.20 0.15 z e z d s e s d e d previous code jeita package code renesas code tlp-113v 0.12g mass[typ.] p-tflga113-8x8-0.65 ptlg0113ja-a m figure f.4 tlp-113v package dimensions
renesas 16-bit single-chip microcomputer hardware manual h8s/2319 group publication date: 1st edition, march 1999 rev.7.00, february 14, 2007 published by: sales strategic planning div. renesas technology corp. edited by: customer support department global strategic communication div. renesas solutions corp. ? 2007. renesas technology corp., all rights reserved. printed in japan.
sales strategic planning div. nippon bldg., 2-6-2, ohte-machi, chiyoda-ku, tokyo 100-0004, japan http://www.renesas.com refer to " http://www.renesas.com/en/network " for the latest and detailed information. renesas technology america, inc. 450 holger way, san jose, ca 95134-1368, u.s.a tel: <1> (408) 382-7500, fax: <1> (408) 382-7501 renesas technology europe limited dukes meadow, millboard road, bourne end, buckinghamshire, sl8 5fh, u.k. tel: <44> (1628) 585-100, fax: <44> (1628) 585-900 renesas technology (shanghai) co., ltd. unit 204, 205, aziacenter, no.1233 lujiazui ring rd, pudong district, shanghai, china 200120 tel: <86> (21) 5877-1818, fax: <86> (21) 6887-7898 renesas technology hong kong ltd. 7th floor, north tower, world finance centre, harbour city, 1 canton road, tsimshatsui, kowloon, hong kong tel: <852> 2265-6688, fax: <852> 2730-6071 renesas technology taiwan co., ltd. 10th floor, no.99, fushing north road, taipei, taiwan tel: <886> (2) 2715-2888, fax: <886> (2) 2713-2999 renesas technology singapore pte. ltd. 1 harbour front avenue, #06-10, keppel bay tower, singapore 098632 tel: <65> 6213-0200, fax: <65> 6278-8001 renesas technology korea co., ltd. kukje center bldg. 18th fl., 191, 2-ka, hangang-ro, yongsan-ku, seoul 140-702, korea tel: <82> (2) 796-3115, fax: <82> (2) 796-2145 renesas technology malaysia sdn. bhd unit 906, block b, menara amcorp, amcorp trade centre, no.18, jalan persiaran barat, 46050 petaling jaya, selangor darul ehsan, malaysia tel: <603> 7955-9390, fax: <603> 7955-9510 renesas sales offices colophon 6.0

h8s/2319 group rej09b0089-0700 hardware manual 1753, shimonumabe, nakahara-ku, kawasaki-shi, kanagawa 211-8668 japan


▲Up To Search▲   

 
Price & Availability of ADE-702-037

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X